nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
641 stars 99 forks source link

Firebase functions location does not work #513

Closed mickaelponsolle closed 3 years ago

mickaelponsolle commented 3 years ago

Hi,

I try to deploy functions on a location different from default (us-central1). I have set the location parameter in nuxt.config.js like this

      functions: {
        location: 'europe-west3',
      }

and I have declared my function like this :

exports.ssrapp = functions.region('europe-west3').https.onRequest(handleRequest);

The function is correctly deployed (it exists in the firebase console) but the function does not work when I try to call it (404 error). At the other side, when I deployed the same function without the location parameter (default = us-central1), it works perfectly. Maybe I missed something but I don't find any hints.

Thanks for your help.

tibs245 commented 3 years ago

You see correctly region "europe-west3" on Google Cloud function ? If you do "F12" for dev console on your navigator, on network tabs => You can see "europe-west3" on the subdomain request ?

If yes : Have you function logs ?

mickaelponsolle commented 3 years ago

Yes, the google cloud function is correctly deployed int the 'europe-west3' region. But after, the cloud function is not called. It seems that the hosting still redirect to the 'us-central1' function which does not exist. There is a parameter to set the cloud function address to the hosting redirect ? My firebase.json looks like this :

{
  "functions": {
    "source": "functions"
  },
  "hosting": {
    "public": "public",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "rewrites": [
      {
        "source": "**",
        "function": "ssrapp"
      }
    ]
  }
}
tibs245 commented 3 years ago

I do not use hosting firebase. Personnaly I use Google Cloud Run.

But your problem is the same when you run nuxt project with npm run dev locally ?

If yes, I don't think hosting solution is relevant to resolve this problem.

The better is resolve is see network request on navigator with local run. Same next picture. requete-github

(F12 for dev mode and network tab, not forget click to trash before sent function request for better readability, and click on button for send firebase function request)

lupas commented 3 years ago

Closing due to inactivity.