-
Notifications
You must be signed in to change notification settings - Fork 206
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
Add debug feature to always enable cors for emulated v2 https functions #1099
Merged
+85
−5
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colerogers
approved these changes
May 6, 2022
colerogers
reviewed
May 6, 2022
jhuleatt
approved these changes
May 6, 2022
taeold
added a commit
to firebase/firebase-tools
that referenced
this pull request
May 6, 2022
Accompanies firebase/firebase-functions#1099. With this change, users using the supported version of the Firebase Functions SDK will be able to bypass existing/default cors settings to call the emulated HTTP/callable v2 functions.
inlined
approved these changes
May 9, 2022
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.
I think we also need to default cors to true to keep parity with V1.
Whoops. I see where we did & still do default to CORS true for Callable functions in v2. |
bkendall
added a commit
to firebase/firebase-tools
that referenced
this pull request
May 10, 2022
* Un-hide CF3v2 (#4525) * Resolve relative paths for local extensions (#4529) * Improve error message when parsing function source fails. (#4527) Previously, an invalid function source would show error message like this: ```bash $ firebase deploy --only functions i deploying functions ... Error: Failed to parse backend specification: - YAMLException incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 65: ... function source: ReferenceError: aa is not defined ``` This is surprising - a YAMLException? A backend specification? Often times, the full error message would curt short, and debugging the issue required the user to carefully inspect the debug log. We improve the error message to the following: ```bash $ firebase deploy --only functions i deploying functions ... Error: Failed to load function definition from source: Failed to generate manifest from function source: ReferenceError: aa is not defined ``` We hid the YAML portion of the error and make sure to relay the full error message returned from the underlying Functions Control API (i.e. the serve responsible for loading and advertising the `functions.yaml` baked into the Functions SDK) * Set `enableCors` debug feature when emulating CF3 functions. (#4528) Accompanies firebase/firebase-functions#1099. With this change, users using the supported version of the Firebase Functions SDK will be able to bypass existing/default cors settings to call the emulated HTTP/callable v2 functions. * Removing extensions-emulator preview flag (#4484) * Removing extensions-emulator preview flag * fix test * Adding changelog entry * formats * Pin to emulator UI v1.7.0 * Fix outdated package.json templates (#4531) * Remove firebase-functions-test dependency * Bump all the dependencies * Inlined.cpu fixes (#4530) * Add extra validation for CPU x memory constraints * Force default memory to avoid MB -> MiB bugs * Unbreak unit tests * Adding CHANGELOG entry for cf3v2 (#4537) * Adding CHANGELOG entry for cf3v2 * gen 2 * More firebase-frameworks work (#4463) * Work with emulators:start * Add dev mode flag * Dev flag not actually needed * Move entry into firebase-tools * Cleanup * Bump dep * fix missing import Co-authored-by: Bryan Kendall <bkend@google.com> Co-authored-by: Thomas Bouldin <inlined@users.noreply.github.com> Co-authored-by: joehan <joehanley@google.com> Co-authored-by: Daniel Lee <danielylee@google.com> Co-authored-by: James Daniels <jamesdaniels@google.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As suggested by @jhuleatt, we add a debug feature in the SDK to enable CORS setting (i.e. set CORS origin setting to allow requests from any origin) during function emulation to make emulator experience less painful. For example, given the following v2 https function:
Users would've had to add
localhost:XXX
to the cors setting to make function emulation work. With the new debug feature (which the Functions emulator will enable), users won't need to make such change.Thanks @jhuleatt for pushing the idea for an excellent feature!