I tried deploying a Firebase function, but I got the following error.
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Refresh token must contain a "client_id" property.
The full terminal output after running deployment is like
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing codebase default for deployment
⚠ functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
⚠ functions: Please note that there will be breaking changes when you upgrade.
i functions: Loaded environment variables from .env.development.
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Refresh token must contain a "client_id" property.
I'm using the following versions for firebase.
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.18.0",
The app initialization code looks like
import * as admin from "firebase-admin";
admin.initializeApp();
Deployment was working about a month ago, so I cloned my git repo again. But, even trying to deploy the same code is giving me the error.
I have proper authentication on my CLI because when I run firebase projects:list
, it shows me the correct list of projects, and firebase use <PROJECT_NAME>
also works.
I also tried manually setting the firebase config in app initialization part by doing
import * as admin from "firebase-admin";
const firebaseConfig = {
apiKey: <VALUE_FROM_FIREBASE_CONSOLE>,
authDomain: <VALUE_FROM_FIREBASE_CONSOLE>,
projectId: <VALUE_FROM_FIREBASE_CONSOLE>,
storageBucket: <VALUE_FROM_FIREBASE_CONSOLE>,
messagingSenderId: <VALUE_FROM_FIREBASE_CONSOLE>,
appId: <VALUE_FROM_FIREBASE_CONSOLE>
};
admin.initializeApp(firebaseConfig);
CodePudding user response:
This is fixed in V11.5.0
released on the 19th of January 2023. After the bug was found and reported on this Github issue.
Please reinstall/update Firebase to fix.
npm install firebase-admin@latest