-
Notifications
You must be signed in to change notification settings - Fork 166
Fix local development with Pub/Sub emulator #272
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
Conversation
73a896c
to
008a9d0
Compare
008a9d0
to
0149bb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Do you mind adding a little more detailed description in the PR for how you tested this locally?
For example, I don't see the use of PUBSUB_EMULATOR_HOST
in the PR here. Some light instructions for how a user can test this manually would help. Even better would be to update the docs we have on this content with the new setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main concern is the middleware for all raw Pub/Sub requests. o.w. lgtm
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
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
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
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
* 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
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 via express middleware that is enable when the
PUBSUB_EMULATOR_HOST
is set.fixes #41, fixes #96