Skip to content

functions.region seem to do a global update #1235

Open
@maelp

Description

@maelp

[REQUIRED] Describe your environment

  • Operating System version: Linux
  • Browser version: n/a
  • Firebase SDK version: v9
  • Firebase Product: functions

[REQUIRED] Describe the problem

Steps to reproduce:

  • we create a util called localized-functions.js which exports a version of the "functions" module with the default region like this:
const DEFAULT_FUNCTIONS_REGION = "europe-west3";

import "firebase-functions/lib/logger/compat";
import * as _functions from "firebase-functions";

export const functions = _functions.region(DEFAULT_FUNCTIONS_REGION);
  • we use it like this in most methods:
# file1.js
import { functions } from "./localized-functions";

export const myTrigger = functions.https.onCall(...)
  • but if we do something like this somewhere:
# file2.js
import { functions } from "./localized-functions";

export const myOtherTrigger = functions.region("europe-west1").https.onCall(...)

this seems to impact globally the "functions" module, and sometimes when deploying cloud functions it indicates that the function in file1 is to be deployed in europe-west1 (rather than europe-west3). More precisely, it tells us that the function myTrigger (europe-west3) exists in the cloud functions from a previous deployment, but no longer exists locally, and asks me whether I want to delete it

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions