Skip to content

Commit

Permalink
fix(pubsublite): fix regional endpoints (#9362)
Browse files Browse the repository at this point in the history
This error started occurring after google.golang.org/api was upgraded to 0.160.0:

> rpc error: code = Unimplemented desc = unexpected HTTP status code received from server: 404 (Not Found); transport: received unexpected content-type "text/html; charset=UTF-8"

Fixes: https://togithub.com/googleapis/google-cloud-go/issues/9331, https://togithub.com/googleapis/google-cloud-go/issues/9328, https://togithub.com/googleapis/google-cloud-go/issues/9329, https://togithub.com/googleapis/google-cloud-go/issues/9330
tmdiep authored Feb 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 62cc619 commit 14ce978
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pubsublite/internal/wire/rpc.go
Original file line number Diff line number Diff line change
@@ -158,9 +158,11 @@ func resourceExhaustedRetryer() gax.CallOption {
}

const (
pubsubLiteDefaultEndpoint = "-pubsublite.googleapis.com:443"
pubsubLiteErrorDomain = "pubsublite.googleapis.com"
resetSignal = "RESET"
pubsubLiteDefaultEndpoint = "-pubsublite.googleapis.com:443"
pubsubLiteDefaultEndpointTemplate = "-pubsublite.UNIVERSE_DOMAIN:443"
defaultUniverseDomain = "googleapis.com"
pubsubLiteErrorDomain = "pubsublite.googleapis.com"
resetSignal = "RESET"
)

// Pub/Sub Lite's RESET signal is a status containing error details that
@@ -184,6 +186,8 @@ func isStreamResetSignal(err error) bool {
func defaultClientOptions(region string) []option.ClientOption {
return []option.ClientOption{
internaloption.WithDefaultEndpoint(region + pubsubLiteDefaultEndpoint),
internaloption.WithDefaultEndpointTemplate(region + pubsubLiteDefaultEndpointTemplate),
internaloption.WithDefaultUniverseDomain(defaultUniverseDomain),
// Detect if transport is still alive if there is inactivity.
option.WithGRPCDialOption(grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 1 * time.Minute,

0 comments on commit 14ce978

Please sign in to comment.