I'm using the Functions Framework with Python alongside Google Cloud Pub/Sub Emulator. I'm having issues with an event triggered from a published message to a topic, where there's no event data found for the function. See more details below.
- Start Pub/Sub Emulator under
http://localhost:8085and project_id islocal-test. - Spin up function with signature-type:
httpunderhttp://localhost:8006. - Given a background cloud function with signature-type:
event:
- Topic is created as
test-topic - Function is spinned up under
http://localhost:8007. - Create push subscription
test-subscriptionfortest-topicfor endpoint:http://localhost:8007
When I publish a message to test-topic from http://localhost:8006 via POST request in Postman, I get back a 200 response to confirm the message was published successfully. The function representing http://localhost:8007 gets executed as an event as shown in the logs from the functions-framework. However, there's no actual data for event when debugging the triggered function.
Has anyone encountered this? Any ideas/suggestions on this?
Perhaps, this is true? #23 Functions Framework does not work with the Pub/Sub emulator
Modules Installed
- functions-framework==2.1.1
- google-cloud-pubsub==2.2.0
python version
- 3.8.8
I'll close this post, since the issue is an actual bug that was reported last year.
Update: As a workaround until this bug is fixed, I copied the code below locally to
functions_framework/__init__.pywithinview_funcnested function, inside_event_view_func_wrapperfunction.