VueFire with Nuxt SSR enabled on Firebase AppHosting #1592
Replies: 1 comment 1 reply
-
Hello @MathiasQM I face the same issue but with deployment to Netlify, I see the similar message. However, I don't have the issue with My solutionWhile writing this reply, I've accidentally fixed the thing. Basically, you generate a json file in the build environment from env variable.
UPDI have searched a bit and found a nice way to deploy on App Hosting with proper secrets handling, haven't tried though: Unfortunately, there's nothing I could do with specifying command or env vars in App Hosting Dashboard which still looks very "in developing", so I would either wait for more mature release or go with CI/CD approach. |
Beta Was this translation helpful? Give feedback.
-
Right, so I've been testing Firebase's new product AppHosting for a nuxt project and it is working quite well. I am having trouble using VueFire with SSR enabled for the Admin SDK. It cannot access the default Firebase app.
The documentation says to use the
GOOGLE_APPLICATION_CREDENTIALS
environment variable if deploying to something other than Firebase or Google Cloud, because App Hosting is a firebase product this should not apply here. Correct me if I'm wrong but App Hosting should be able to authenticate and use the admin SDK using the default service-account, according to this documentation.In development
So in development everything works just fine with the client side and server side. It. works because it has acces to the service-account.json and the .env file, which has the
GOOGLE_APPLICATION_CREDENTIALS
environment variable pointing to my service account. These files are stored locally in the project during development.In production
Because app hosting is deployed form the main branch of my github repo, it does not have access to my service-account.json and .env files as these are not committed to github (for obvious reasons). In this case VueFire/nuxtfire should be able to initialize using the Application Default Credentials. But It throws this error:
500
Failed to read credentials from file export GOOGLE_APPLICATION_CREDENTIALS='{ "type": "service_account", "project_id": "your-project-id", "private_key_id": "your-private-key-id", "private_key": "-----BEGIN PRIVATE KEY----- .....
And it actually throws the error with these placeholders "project_id": "your-project-id" and not my actual projectid.
Have anyone had this issue or experience with VueFire on App Hosting with SSR enabled?
Note with SSR disabled everything works
Beta Was this translation helpful? Give feedback.
All reactions