From f95edb0c66ec78b275527d7e955db8647809e11e Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 28 Sep 2020 12:49:48 -0700 Subject: [PATCH 1/5] Bind window to passed fetch --- packages/functions/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/functions/index.ts b/packages/functions/index.ts index 1996574328d..f9f55fc515a 100644 --- a/packages/functions/index.ts +++ b/packages/functions/index.ts @@ -21,7 +21,7 @@ import { registerFunctions } from './src/config'; import { name, version } from './package.json'; -registerFunctions(firebase as _FirebaseNamespace, fetch); +registerFunctions(firebase as _FirebaseNamespace, window.fetch.bind(window)); firebase.registerVersion(name, version); declare module '@firebase/app-types' { From b2806cf782a5f2b8ba6395cf05d8c000c63f617e Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 28 Sep 2020 12:50:57 -0700 Subject: [PATCH 2/5] Also in functions-exp --- packages-exp/functions-exp/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages-exp/functions-exp/src/index.ts b/packages-exp/functions-exp/src/index.ts index 3ebaeb7034a..fbbf632fa6f 100644 --- a/packages-exp/functions-exp/src/index.ts +++ b/packages-exp/functions-exp/src/index.ts @@ -21,5 +21,5 @@ import { name, version } from '../package.json'; export * from './api'; -registerFunctions(fetch); +registerFunctions(window.fetch.bind(window)); registerVersion(name, version); From 37c02354702f43776a487daa9831f4d800715348 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 28 Sep 2020 14:36:24 -0700 Subject: [PATCH 3/5] Change binding to self --- packages-exp/functions-exp/src/index.ts | 2 +- packages/functions/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages-exp/functions-exp/src/index.ts b/packages-exp/functions-exp/src/index.ts index fbbf632fa6f..ad8b299b634 100644 --- a/packages-exp/functions-exp/src/index.ts +++ b/packages-exp/functions-exp/src/index.ts @@ -21,5 +21,5 @@ import { name, version } from '../package.json'; export * from './api'; -registerFunctions(window.fetch.bind(window)); +registerFunctions(fetch.bind(self)); registerVersion(name, version); diff --git a/packages/functions/index.ts b/packages/functions/index.ts index f9f55fc515a..24dbbdca2b2 100644 --- a/packages/functions/index.ts +++ b/packages/functions/index.ts @@ -21,7 +21,7 @@ import { registerFunctions } from './src/config'; import { name, version } from './package.json'; -registerFunctions(firebase as _FirebaseNamespace, window.fetch.bind(window)); +registerFunctions(firebase as _FirebaseNamespace, fetch.bind(self)); firebase.registerVersion(name, version); declare module '@firebase/app-types' { From d4e234d8d41cc9cd113a3f848d8a04dba9c3ff39 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 30 Sep 2020 11:16:10 -0700 Subject: [PATCH 4/5] Add changeset --- .changeset/dirty-rings-cry.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dirty-rings-cry.md diff --git a/.changeset/dirty-rings-cry.md b/.changeset/dirty-rings-cry.md new file mode 100644 index 00000000000..5211d100c68 --- /dev/null +++ b/.changeset/dirty-rings-cry.md @@ -0,0 +1,6 @@ +--- +'@firebase/functions-exp': patch +'@firebase/functions': patch +--- + +Fixes a bug introduced in #3782 that causes callable functions to throw an error in browser extensions. From 299ed28a671993a3d75e86d9a6790fe949cff18c Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Thu, 1 Oct 2020 08:35:08 -0700 Subject: [PATCH 5/5] Remove exp package from changeset --- .changeset/dirty-rings-cry.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changeset/dirty-rings-cry.md b/.changeset/dirty-rings-cry.md index 5211d100c68..d3fbefbbe51 100644 --- a/.changeset/dirty-rings-cry.md +++ b/.changeset/dirty-rings-cry.md @@ -1,5 +1,4 @@ --- -'@firebase/functions-exp': patch '@firebase/functions': patch ---