Skip to content

Commit ced9f6c

Browse files
Bump the go-dependencies group across 1 directory with 2 updates (#194)
* Bump the go-dependencies group across 1 directory with 2 updates Bumps the go-dependencies group with 2 updates in the / directory: [cloud.google.com/go/pubsub/v2](https://github.com/googleapis/google-cloud-go) and [google.golang.org/api](https://github.com/googleapis/google-api-go-client). Updates `cloud.google.com/go/pubsub/v2` from 2.0.0 to 2.3.0 - [Release notes](https://github.com/googleapis/google-cloud-go/releases) - [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md) - [Commits](googleapis/google-cloud-go@pubsub/v2.0.0...pubsub/v2.3.0) Updates `google.golang.org/api` from 0.247.0 to 0.258.0 - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](googleapis/google-api-go-client@v0.247.0...v0.258.0) --- updated-dependencies: - dependency-name: cloud.google.com/go/pubsub/v2 dependency-version: 2.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: google.golang.org/api dependency-version: 0.258.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> * gcp pubsub fix Signed-off-by: Sanket Sudake <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Sanket Sudake <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sanket Sudake <[email protected]>
1 parent 6905007 commit ced9f6c

File tree

4 files changed

+90
-80
lines changed

4 files changed

+90
-80
lines changed

gcp-pubsub-http-connector/main.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ func main() {
3838
defer func() {
3939
_ = logger.Sync()
4040
}()
41+
ctx, cancel := context.WithCancel(context.Background())
42+
defer cancel()
4143

4244
connectordata, err := common.ParseConnectorMetadata()
4345
if err != nil {
4446
logger.Error("Environment variable is missing ", zap.Error(err))
45-
os.Exit(127)
47+
return
4648
}
4749

4850
pubsubInfo, err := GetGCPInfo()
@@ -57,13 +59,14 @@ func main() {
5759
}
5860

5961
logger.Info("Conn: %s", zap.String("Response topic", conn.connectordata.ResponseTopic))
60-
err = conn.consumeMessage()
62+
err = conn.consumeMessage(ctx)
6163
if err != nil {
6264
logger.Error("Error in consuming message from pubsub", zap.Error(err))
65+
return
6366
}
6467
}
6568

66-
func (conn pubsubConnector) consumeMessage() error {
69+
func (conn pubsubConnector) consumeMessage(ctx context.Context) error {
6770
creds := []byte(conn.pubsubInfo.Creds)
6871
headers := http.Header{
6972
"KEDA-Topic": {conn.connectordata.Topic},
@@ -72,8 +75,7 @@ func (conn pubsubConnector) consumeMessage() error {
7275
"Content-Type": {conn.connectordata.ContentType},
7376
"KEDA-Source-Name": {conn.connectordata.SourceName},
7477
}
75-
ctx := context.Background()
76-
client, err := pubsub.NewClient(ctx, conn.pubsubInfo.ProjectID, option.WithCredentialsJSON(creds))
78+
client, err := pubsub.NewClient(ctx, conn.pubsubInfo.ProjectID, option.WithAuthCredentialsJSON(option.ServiceAccount, creds))
7779
if err != nil {
7880
conn.logger.Error(err.Error())
7981
return err
@@ -95,22 +97,22 @@ func (conn pubsubConnector) consumeMessage() error {
9597
resp, err := common.HandleHTTPRequest(string(msg.Data), headers, conn.connectordata, conn.logger)
9698
if err != nil {
9799
if conn.connectordata.ErrorTopic != "" {
98-
conn.responseOrErrorHandler(conn.connectordata.ErrorTopic, err.Error(), headers)
100+
conn.responseOrErrorHandler(ctx, conn.connectordata.ErrorTopic, err.Error(), headers)
99101
}
100102
conn.logger.Error("Error sending the message to the endpoint %v", zap.Error(err))
101103
} else {
102104
defer resp.Body.Close()
103105
body, err := io.ReadAll(resp.Body)
104106
if err != nil {
105107
if conn.connectordata.ErrorTopic != "" {
106-
conn.responseOrErrorHandler(conn.connectordata.ErrorTopic, string(body), headers)
108+
conn.responseOrErrorHandler(ctx, conn.connectordata.ErrorTopic, string(body), headers)
107109
}
108110
conn.logger.Error("Error reading body", zap.Error(err))
109111

110112
} else {
111113
msg.Ack()
112114
if conn.connectordata.ResponseTopic != "" {
113-
conn.responseOrErrorHandler(conn.connectordata.ResponseTopic, string(body), headers)
115+
conn.responseOrErrorHandler(ctx, conn.connectordata.ResponseTopic, string(body), headers)
114116
}
115117
conn.logger.Info("Success in sending the message", zap.Any("Messsage sent: ", msg))
116118
}
@@ -123,10 +125,8 @@ func (conn pubsubConnector) consumeMessage() error {
123125
return nil
124126
}
125127

126-
func (conn pubsubConnector) responseOrErrorHandler(topicID string, response string, headers http.Header) {
127-
128-
ctx := context.Background()
129-
client, err := pubsub.NewClient(ctx, conn.pubsubInfo.ProjectID, option.WithCredentialsJSON([]byte(conn.pubsubInfo.Creds)))
128+
func (conn pubsubConnector) responseOrErrorHandler(ctx context.Context, topicID string, response string, headers http.Header) {
129+
client, err := pubsub.NewClient(ctx, conn.pubsubInfo.ProjectID, option.WithAuthCredentialsJSON(option.ServiceAccount, []byte(conn.pubsubInfo.Creds)))
130130
if err != nil {
131131
conn.logger.Error("pubsub.NewClient: %v", zap.Error(err))
132132
}

gcp-pubsub-http-connector/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.13
1+
v0.14

go.mod

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/fission/keda-connectors
33
go 1.25.5
44

55
require (
6-
cloud.google.com/go/pubsub/v2 v2.0.0
6+
cloud.google.com/go/pubsub/v2 v2.3.0
77
github.com/IBM/sarama v1.46.3
88
github.com/aws/aws-sdk-go-v2 v1.41.0
99
github.com/aws/aws-sdk-go-v2/config v1.32.6
@@ -16,15 +16,15 @@ require (
1616
github.com/rs/xid v1.6.0
1717
github.com/xdg/scram v1.0.5
1818
go.uber.org/zap v1.27.1
19-
google.golang.org/api v0.247.0
19+
google.golang.org/api v0.258.0
2020
sigs.k8s.io/controller-runtime v0.22.4
2121
)
2222

2323
require (
2424
cloud.google.com/go v0.121.6 // indirect
25-
cloud.google.com/go/auth v0.16.4 // indirect
25+
cloud.google.com/go/auth v0.17.0 // indirect
2626
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
27-
cloud.google.com/go/compute/metadata v0.8.0 // indirect
27+
cloud.google.com/go/compute/metadata v0.9.0 // indirect
2828
cloud.google.com/go/iam v1.5.2 // indirect
2929
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
3030
github.com/aws/aws-sdk-go-v2/credentials v1.19.6 // indirect
@@ -52,7 +52,7 @@ require (
5252
github.com/golang/snappy v0.0.4 // indirect
5353
github.com/google/s2a-go v0.1.9 // indirect
5454
github.com/google/uuid v1.6.0 // indirect
55-
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
55+
github.com/googleapis/enterprise-certificate-proxy v0.3.7 // indirect
5656
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
5757
github.com/hashicorp/go-uuid v1.0.3 // indirect
5858
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
@@ -68,26 +68,25 @@ require (
6868
github.com/pierrec/lz4/v4 v4.1.22 // indirect
6969
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
7070
github.com/xdg/stringprep v1.0.3 // indirect
71-
go.einride.tech/aip v0.73.0 // indirect
7271
go.etcd.io/bbolt v1.3.11 // indirect
7372
go.opencensus.io v0.24.0 // indirect
74-
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
73+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
7574
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
7675
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
77-
go.opentelemetry.io/otel v1.36.0 // indirect
78-
go.opentelemetry.io/otel/metric v1.36.0 // indirect
79-
go.opentelemetry.io/otel/trace v1.36.0 // indirect
76+
go.opentelemetry.io/otel v1.38.0 // indirect
77+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
78+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
8079
go.uber.org/multierr v1.11.0 // indirect
81-
golang.org/x/crypto v0.43.0 // indirect
82-
golang.org/x/net v0.46.0 // indirect
83-
golang.org/x/oauth2 v0.30.0 // indirect
84-
golang.org/x/sync v0.17.0 // indirect
85-
golang.org/x/sys v0.37.0 // indirect
86-
golang.org/x/text v0.30.0 // indirect
87-
golang.org/x/time v0.12.0 // indirect
80+
golang.org/x/crypto v0.46.0 // indirect
81+
golang.org/x/net v0.48.0 // indirect
82+
golang.org/x/oauth2 v0.34.0 // indirect
83+
golang.org/x/sync v0.19.0 // indirect
84+
golang.org/x/sys v0.39.0 // indirect
85+
golang.org/x/text v0.32.0 // indirect
86+
golang.org/x/time v0.14.0 // indirect
8887
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
89-
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
90-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect
91-
google.golang.org/grpc v1.74.2 // indirect
92-
google.golang.org/protobuf v1.36.7 // indirect
88+
google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect
89+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 // indirect
90+
google.golang.org/grpc v1.77.0 // indirect
91+
google.golang.org/protobuf v1.36.11 // indirect
9392
)

0 commit comments

Comments
 (0)