Skip to content

Conversation

@matthewrobertson
Copy link
Member

Currently, deploying a function with --trigger-topic creates a Pub/Sub subscription that delivers events to an internal endpoint that marshals request payloads before forwarding them to a user's function. Unfortunately, this breaks local development with the Pub/Sub emulator as the Functions Frameworks are dependent on this request marshalling logic.

In order to better support local development and testing with the Pub/Sub emulator, this commit introduces the event marshalling logic to the Functions Framework. Marshalling is enabled when the signature_type is event or cloudevent and the request body matches the schema of a Pub/Sub request.

Fixes #23

@google-cla google-cla bot added the cla: yes label Apr 21, 2021
@matthewrobertson matthewrobertson force-pushed the fix-local-dev-with-pubsub-emulator branch from b926043 to ea50474 Compare April 21, 2021 19:02
@matthewrobertson matthewrobertson requested a review from di April 22, 2021 22:25
@matthewrobertson matthewrobertson force-pushed the fix-local-dev-with-pubsub-emulator branch from feb2600 to 6761f30 Compare April 27, 2021 07:01
@matthewrobertson matthewrobertson force-pushed the fix-local-dev-with-pubsub-emulator branch from 6761f30 to 77df302 Compare April 27, 2021 19:08
@matthewrobertson matthewrobertson merged commit df48822 into master Apr 27, 2021
@matthewrobertson matthewrobertson deleted the fix-local-dev-with-pubsub-emulator branch April 27, 2021 23:58
matthewrobertson added a commit to GoogleCloudPlatform/functions-framework-java that referenced this pull request Jun 28, 2021
Currently, the functions frameworks are dependent on some private
dataplane event marshalling logic in order to correctly pass PubSub
events to background functions. This commit implements the same
marshalling logic in the FF in order to enable local development using
the PubSub emulator.

We have already made this change in other languages:
GoogleCloudPlatform/functions-framework-nodejs#272
GoogleCloudPlatform/functions-framework-ruby#100
GoogleCloudPlatform/functions-framework-python#121
GoogleCloudPlatform/functions-framework-go#70
matthewrobertson added a commit to GoogleCloudPlatform/functions-framework-java that referenced this pull request Jun 28, 2021
Currently, the functions frameworks are dependent on some private
dataplane event marshalling logic in order to correctly pass PubSub
events to background functions. This commit implements the same
marshalling logic in the FF in order to enable local development using
the PubSub emulator.

We have already made this change in other languages:
GoogleCloudPlatform/functions-framework-nodejs#272
GoogleCloudPlatform/functions-framework-ruby#100
GoogleCloudPlatform/functions-framework-python#121
GoogleCloudPlatform/functions-framework-go#70
matthewrobertson added a commit to GoogleCloudPlatform/functions-framework-java that referenced this pull request Jun 30, 2021
Currently, the functions frameworks are dependent on some private
dataplane event marshalling logic in order to correctly pass PubSub
events to background functions. This commit implements the same
marshalling logic in the FF in order to enable local development using
the PubSub emulator.

We have already made this change in other languages:
GoogleCloudPlatform/functions-framework-nodejs#272
GoogleCloudPlatform/functions-framework-ruby#100
GoogleCloudPlatform/functions-framework-python#121
GoogleCloudPlatform/functions-framework-go#70
matthewrobertson added a commit to GoogleCloudPlatform/functions-framework-java that referenced this pull request Jul 2, 2021
Currently, the functions frameworks are dependent on some private
dataplane event marshalling logic in order to correctly pass PubSub
events to background functions. This commit implements the same
marshalling logic in the FF in order to enable local development using
the PubSub emulator.

We have already made this change in other languages:
GoogleCloudPlatform/functions-framework-nodejs#272
GoogleCloudPlatform/functions-framework-ruby#100
GoogleCloudPlatform/functions-framework-python#121
GoogleCloudPlatform/functions-framework-go#70
matthewrobertson added a commit to GoogleCloudPlatform/functions-framework-java that referenced this pull request Jul 7, 2021
* unblock local development with the pubsub emulator

Currently, the functions frameworks are dependent on some private
dataplane event marshalling logic in order to correctly pass PubSub
events to background functions. This commit implements the same
marshalling logic in the FF in order to enable local development using
the PubSub emulator.

We have already made this change in other languages:
GoogleCloudPlatform/functions-framework-nodejs#272
GoogleCloudPlatform/functions-framework-ruby#100
GoogleCloudPlatform/functions-framework-python#121
GoogleCloudPlatform/functions-framework-go#70

* fix code style issues
@di
Copy link
Member

di commented Aug 11, 2021

Per #23 (comment) this doesn't quite fix #23, so I've reopened that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functions Framework does not work with the Pub/Sub emulator

3 participants