Description
Reproduction
https://github.com/johnpuaoi/vuefire-auth-blocked
Steps to reproduce the bug
- Replace the firebase config with your own.
- Create an ENV and add the GOOGLE_APPLICATION_CREDENTIALS
- Build the nuxt 3 app with pnpm build
- Run node .output/server/index.mjs --host 0.0.0.0
- Open localhost:3000
- Attempt to sign in with a user account on app.vue main page
Expected behavior
After signing in the user information should be displayed. The sign in should not be blocked.
Actual behavior
The sign in is blocked and an error is shown.
Additional information
This only happens when SSR is enabled and you build for production, in dev mode this does not happen at all. If you disable SSR then everything works as should in production.
The credentials are set using the GOOGLE_APPLICATION_CREDENTIALS env var which is an object of the service key. I tried setting the var to be a path to serviceKey.json file but still the same error.
This is the error that is returned: Error minting the cookie FirebaseAppError: Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "Error fetching access token: Error while making request: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND".
For now I will release my nuxt 3 apps as an SPA until this can be resolved. I attempted to take a crack at this issue by inserting some console.logs in the ensureAdminApp function to check the credential but can't seem to narrow down the issue.
Again this only happens if your using SSR with nuxt and you build for production. SSR in dev mode works just fine with nuxt-vuefire.