-
Notifications
You must be signed in to change notification settings - Fork 44
Unable to receive events from the local pubsub emulator #85
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
Comments
Some things I've noticed while testing this a little further. On my local machine, the body of the request looks like this :
It appears that the legacy event converter support this format. In Google Cloud Functions, the body of the request is:
which the legacy event converter knows how to convert to a cloud event. I'm just not sure how to get the data in the above format in my dev environment to play around with this locally. |
Thanks for the update. I haven't looked at the pubsub emulator, but it's definitely plausible that it's emitting events in a different format than the production service. We'll need to figure out from the pubsub team what's behind the differences you're seeing. |
The request bodies I posted in my last message were actually from Google PubSub, not the emulator. Sorry for the confusion. |
Oh, I see, yes you mentioned in your original description that you were pushing messages from the actual PubSub service to your local machine. You're right: there is special integration between the PubSub service and Cloud Functions, where Cloud Functions converts a raw PubSub message to the format recognized by the Functions Framework's event converter. But this integration doesn't happen if you're running locally (or, I imagine, other non-serverless environments such as a straight GCE VM) and so you see the raw PubSub message that the Functions Framework doesn't know how to convert. I'm going to need to get some eyes on this from our serverless specialists, so give me a few days. We should be able to enhance the legacy event converter to recognize raw PubSub message format, but I want to make sure this gets handled properly across languages and that we don't clobber other use cases. Thanks much for the report! |
That makes sense. I thought there might be something like that going on behind the scenes, but couldn't find any documentation about it. Now that I know this, I feel a little more comfortable putting in a temporary monkey patch when running locally to work around this for now. Thanks! |
@dazuma hi, any updates on this issue? |
Sorry for the delay here. It looks like we are adding this logic into the functions frameworks (example from Python), so we'll get it done for Ruby as well. |
Released in the gem version 0.10.0 |
I have an extremely basic example that I am trying to get running locally with the pubsub emulator using push subscriptions. Here is my
app.rb
file:I start up the server using
I then open up a Rails console with the following to create a topic, subscription, and publish a message:
The following error shows up repeatedly in the
functions_framework
server log:Thinking that the issue might possibly be related to the pubsub emulator, I created a topic and push subscription using the actual Google PubSub service, and used ngrok to open up port 8080 so it could push messages to my local computer, and I am getting the exact same errors.
However, if I put my basic example in a Google Cloud Function, it works fine. I'm just running into the issue locally.
I found an example on one of the other functions_framework libraries (nodeJS maybe?) where they recommended trying the following:
where mockPubsub.json was a basic message to send, and that works locally.
Any thoughts/suggestions to get this working locally?
The text was updated successfully, but these errors were encountered: