-
Notifications
You must be signed in to change notification settings - Fork 217
Open
Labels
Description
Related issues
[REQUIRED] Version info
node:
v18.7.0
firebase-functions:
v4.5.0
firebase-tools:
firebase-admin:
v11.11.1
[REQUIRED] Test case
In Firebase Cloud Functions V2, when using setGlobalOptions
to set the region to asia-northeast1
, some Firestore trigger functions are still being initialized in the default region us-central1
.
[REQUIRED] Steps to reproduce
- Set up a Firebase Cloud Function using
setGlobalOptions
to specify the region asasia-northeast1
. - Define a Firestore trigger function in the Firebase Functions codebase.
- Deploy the project using Firebase CLI.
- Check the Firebase CLI logs to see in which region the function has been initialized.
- Notice that the function is initialized in
us-central1
instead of the specifiedasia-northeast1
.
[REQUIRED] Expected behavior
All functions should respect the global options set, especially regarding the region. The expected behavior is that functions are initialized in the specified region asia-northeast1
.
[REQUIRED] Actual behavior
Functions such as Firestore triggers are being initialized in the us-central1
region, despite the setGlobalOptions
specifying asia-northeast1
.
code
[functions/index.js]
import { initializeApp, applicationDefault } from 'firebase-admin/app';
import { setGlobalOptions } from 'firebase-functions/v2';
initializeApp({
credential: applicationDefault(),
});
setGlobalOptions({
region: 'asia-northeast1',
timeoutSeconds: 540,
memory: '2GiB',
minInstances: 0,
maxInstances: 5,
concurrency: 2,
});
export * as v1 from '#root/v1/index.js';
[functions/v1/index.js]
import * as patch from '#root/v1/patch/index.js';
export {
// auth,
// firestore,
// storage,
// https,
patch,
};
[functions/v1/patch/index.js]
import { onDocumentUpdated } from 'firebase-functions/v2/firestore';
export const onCreateManagementTemplate = onDocumentUpdated(
{
document: '...',
},
async (event) => {
//
},
);
log
✔ functions: Loaded functions definitions from source: v1.patch.onCreateManagementTemplate.
✔ functions[us-central1-v1-patch-onCreateManagementTemplate]: firestore function initialized.
Were you able to successfully deploy your functions?
Yes, the functions were deployed successfully, but the regional setting was not applied as expected.
RuiMacedo, OskarGroth, danielgorka, ebsangam, vendoshi and 4 moreOskarGroth