Search code examples
firebasegoogle-cloud-functionsfirebase-hosting

Firebase dynamic hosting asks for authentication after region change


I have been serving dynamic content with a cloud function for some time. Now, I tried changing the region of the cloud function by using region() in the function builder:

// Old
export const serveContent = functions
    .https
    .onRequest((req, res) => {...})

// New
export const serveContent = functions
    .region("europe-west1")
    .https
    .onRequest((req, res) => {...})

During this change I did not modify my rewrites in the firebase.json.

Now, the requests do not reach the cloud function anymore (there are no invocations shown in the logs) and my browser gets redirected with a 302 Found status code to a page prompting for authentication. How can I keep serving content without authentication?

enter image description here

Edit:

Both cloud functions have the Cloud Functions-Invoker role set for allUsers: enter image description here


Solution

  • The prompt for authentication is just a side-effect of the real problem. The docs state:

    Firebase Hosting supports Cloud Functions in us-central1 only.