LearnToday
LearnToday

Reputation: 2902

Firebase Hosting proxy to Cloud Functions only triggers in us-central1

I have my firebase cloud functions created with region: asia-northeast1, I am trying to trigger one of the functions using the firebase.json file.

  "hosting": [
    {
      "target": "ksite",
      "public": "public",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        { "source": "**", "function": "ssr" }
      ]
    }
  ]

Unfortunately this triggers the function with region of us-central1 https://us-central1-site.cloudfunctions.net/ssr/ instead of asia-northeast1 something like this https://asia-northeast1-site.cloudfunctions.net/ssr/

How and why is this happening?

Here is my function:

// For Universal Rendering
export const ssr = functions.region('asia-northeast1').https.onRequest((request, response) => {
    require(`${process.cwd()}/dist/ksite-webpack/server`).app(request, response);
});

Upvotes: 1

Views: 1544

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317412

Firebase Hosting currently only supports the proxy of URLs to functions deployed to us-central1, as mentioned in the documentation:

Important: Firebase Hosting supports Cloud Functions in us-central1 only.

And also here in the docs:

Important: If you are using HTTP functions to serve dynamic content for Firebase Hosting, you must use us-central1.

Upvotes: 2

Related Questions