Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pubsub: Unable to publish message from GAE Standard #702

Closed
d2g opened this issue Jul 21, 2017 · 9 comments
Closed

pubsub: Unable to publish message from GAE Standard #702

d2g opened this issue Jul 21, 2017 · 9 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Comments

@d2g
Copy link

d2g commented Jul 21, 2017

Using GAE standard environment I am unable to publish messages.

I created the following Repository (https://github.com/d2g/dg-pubsubtest) to demonstrate the issue and also tried utilising task queues to extend the timeout. In either case it hangs awaiting the get(ctx) response.

If I run this on the development server I get the following:
Unsolicited response received on idle HTTP channel starting with "HTTP/1.1 408 Request Timeout\r\nContent-Length: 0\r\nContent-Type: text/plain\r\n\r\n"; err=

Followed By
ERROR: context expired before API call remote_socket/Resolve completed

If I remove the get(ctx) the requests completes on the with a 200 but no message is delivered to the topic.

I apologise in advance if this is my issue, I did try the google-appengine-go forum first.

@jba
Copy link
Contributor

jba commented Jul 21, 2017

/cc @zombiezen @broady

@jba jba added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. api: pubsub Issues related to the Pub/Sub API. labels Jul 21, 2017
@zombiezen
Copy link
Contributor

As per https://cloud.google.com/pubsub/docs/reference/libraries (first paragraph), we recommend using the older client library at google.golang.org/api/pubsub/v1 on App Engine Standard.

That said, publishing using this client should (mostly) work, as long as the Client is request-scoped. Pull subscribing will probably not (especially synchronously in the same request), as the client is intended to be running as a long-running connection over the process, which App Engine Standard fundamentally doesn't support. You can instead use push subscriptions.

@d2g
Copy link
Author

d2g commented Jul 22, 2017

I'll look into the older client to see if I can use that to workaround the issue.

In my example repository, the client is request-scoped and I tried to simplify the example as much as possible (only publishing a singular small message to an existing topic).

@broady
Copy link
Contributor

broady commented Jul 22, 2017

Hi @d2g, for publishing, you can try this code:

https://gist.github.com/broady/c79a65cb49d7b6a56448b3345a23b3d6

@d2g
Copy link
Author

d2g commented Jul 22, 2017

@broady Thanks that works great.

Is the intention to update the documentation to reflect that GAE standard only supports v1 (not that it's just recommended) or get the later client to provide some/minimal support?

@broady
Copy link
Contributor

broady commented Jul 22, 2017

I think the current documentation is OK, but making the client better support GAE standard would also be good. That's up to @jba.

@jba jba self-assigned this Aug 8, 2017
@jba
Copy link
Contributor

jba commented Aug 9, 2017

Given the increased weight of Topic.Publish, it doesn't seem a good fit in a request-scoped setting. I think we shouldn't try to make this client work better on GAE standard.

@jba jba closed this as completed Aug 9, 2017
@leighmcculloch
Copy link

I think it's worth updating the documentation here that states that recommend using the older Google APIs Client Libraries if running on Google App Engine standard environment, to explicitly link to the library it is referencing: google.golang.org/api/pubsub/v1. It was tricky to figure out what this document meant by the "older Google APIs". It wasn't until I found this Github issue that I found out what I needed to import.

snsinfu added a commit to snsinfu/bit4 that referenced this issue Apr 2, 2018
The pubsub library is unsupported on GAE standard:

googleapis/google-cloud-go#702

Maybe I should try Python...
nagachika added a commit to groovenauts/magellan-log-collector that referenced this issue Aug 6, 2018
Use google.golang.org/api/pubsub/v1 to publish Cloud PubSub topic.
See googleapis/google-cloud-go#702
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.
Projects
None yet
Development

No branches or pull requests

6 participants