Skip to content

provided region for cloud functions is ignored #2909

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
YannicEl opened this issue Aug 30, 2021 · 5 comments
Closed

provided region for cloud functions is ignored #2909

YannicEl opened this issue Aug 30, 2021 · 5 comments

Comments

@YannicEl
Copy link

Version info

Angular: 12.2.3

Firebase: 9.0.0

AngularFire: 7.0.0

Other (e.g. Ionic/Cordova, Node, browser, operating system): node: v14.17.0, chrome: 92.0.4515.159

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

i could't get angularfire 7 running in stackblitz, sorry.

Steps to set up and reproduce

  1. Setup a angualrfire 7 project
  2. use the provideFunctions method in the app.module.ts
  3. specify a region in the getFunctions function
@NgModule({
  ...
  imports: [
    provideFirebaseApp(() => initializeApp(environment.firebase)),
    provideFunctions(() => getFunctions(getApp(), 'europe-west1')),
  ],
  ...
})

Debug output

image
The function is called from the default region even though I specified a region

Expected behavior

The function should be called with the region 'europe-west1'

Actual behavior

The function is called with the default region 'us-central1'

I think the provided region for cloud functions is ignored.

@jamesdaniels
Copy link
Member

Hmmm... good catch. It's probably that the injected Functions instance is the "default" instance with respect to the SDK. Clearly I should prioritize the one that is passed to provideFunctions...

In the meantime you should be able to access your function initialized with a region by injecting the FunctionsInstances array.

@jamesdaniels jamesdaniels mentioned this issue Aug 30, 2021
jamesdaniels added a commit that referenced this issue Aug 30, 2021
### Bug fixes

* **messaging:** `onMessage` will no longer destablize the Angular Zone
* **core:** Injected Classes now have a better fallback pattern for finding defaults, [#2909](#2909) allowing use of emulators and other config options as expected
* **schematic:** upgrade schematic will no longer rewrite `.ts` files outside of your project root, [#2907](#2907)

### Misc

* **changelog(7.0.0):** break notice for `compat/auth#useEmulator`
* **changelog(7.0.0):** feature of `compat/storage#useEmulator`
* **changelog(7.0.1):** Added entry
* **sample(modular):** Adding `connectEmulator` examples
* **sample(compat):** Cleaned up the service worker registration
* **functions:** defensively load auth first, if provided
* **storage:** defensively load auth first, if provided
* **compat/firestore:** clean up how auth is initialized
* **compat/database:** clean up how auth is initialized
@jamesdaniels
Copy link
Member

Cutting 7.0.1 now, which will have the fix. Thanks for catching this!

@YannicEl
Copy link
Author

wow that was quick. thanks a lot.

@Dimitri-Jacquin
Copy link

Dimitri-Jacquin commented Feb 6, 2022

Excuse me I still have the same error, i am on an angular 13 version and angularfire 7.2. For the moment I use the cloud functions emulator. Could you unblock me?

@GaneshVersionx
Copy link

getApp(), '

Hmmm... good catch. It's probably that the injected Functions instance is the "default" instance with respect to the SDK. Clearly I should prioritize the one that is passed to provideFunctions...

In the meantime you should be able to access your function initialized with a region by injecting the FunctionsInstances array.

I'm not getting briefly explanation Please

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants