-
Notifications
You must be signed in to change notification settings - Fork 940
Functions: Bind passed fetch function #3853
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
🦋 Changeset detectedLatest commit: 299ed28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Binary Size ReportAffected SDKs
Test Logs |
Size Analysis ReportAffected Products
|
Type | Base (01bb65b) | Head (f16e945) | Diff |
---|---|---|---|
size | 1.98 kB | 1.99 kB | +11 B (+0.6%) |
size_with_ext_deps | 5.86 kB | 5.87 kB | +11 B (+0.2%) |
httpsCallable
Size
Type | Base (01bb65b) | Head (f16e945) | Diff |
---|---|---|---|
size | 5.33 kB | 5.34 kB | +11 B (+0.2%) |
size_with_ext_deps | 9.92 kB | 9.93 kB | +11 B (+0.1%) |
useFunctionsEmulator
Size
Type | Base (01bb65b) | Head (f16e945) | Diff |
---|---|---|---|
size | 1.94 kB | 1.95 kB | +11 B (+0.6%) |
size_with_ext_deps | 5.79 kB | 5.80 kB | +11 B (+0.2%) |
@firebase/performance-exp
-
getPerformance
Size
Type Base (01bb65b) Head (f16e945) Diff size 16.8 kB 16.8 kB +36 B (+0.2%) size_with_ext_deps 21.8 kB 33.8 kB +12.0 kB (+54.9%) -
trace
Size
Type Base (01bb65b) Head (f16e945) Diff size 16.7 kB 16.7 kB +36 B (+0.2%) size_with_ext_deps 21.7 kB 33.8 kB +12.1 kB (+55.5%)
Test Logs
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.
Can you please add changeset?
Changeset added! |
.changeset/dirty-rings-cry.md
Outdated
@@ -0,0 +1,6 @@ | |||
--- | |||
'@firebase/functions-exp': patch |
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.
Please remove @firebase/functions-exp
. Exp packages should not be included in changeset.
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.
Done.
Changeset File Check
|
(cherry picked from commit 53ccf19)
@hsubox76 +1 for fixing the security issue with I managed to dig-out the error to be Anyway, with new Thanks! |
Thanks for the additional information that it isn't just Chrome extensions. As for throwing the error instead of hiding it, I did look into that, but it's tricky. Most of the time, the error that comes from the try/catch around the "fetch" is simply "Failed to fetch" (on Chrome) which will happen if it's a network error, but also if there is an error in the actual Cloud Function code, which would be misleading and cause developers to waste time trying to debug network issues instead of checking the function code. So when it was originally coded, the decision was made to hide the error because it was potentially more misleading than helpful. If there was a way to detect and hide "Failed to fetch" errors, we could throw all other errors. However it seems brittle to detect it based on message text, which could change, and the type is TypeError, same as the one we would want to show, above. Additionally, on Firefox the error text is "NetworkError when attempting to fetch resource" and who knows what it is in other browsers. |
Fix a bug caused by PR #3782 to replace isomorphic-fetch dependency in functions. Bug occurs in Chrome extensions and possibly other environments. When passing
fetch
function as an argument it loseswindow
context. Bindingself
so that it will work in service workers as well.See https://stackoverflow.com/questions/44720448/fetch-typeerror-failed-to-execute-fetch-on-window-illegal-invocation for a similar issue.
Fixes #3849