-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Summary:
When attempting to deploy a Firebase project, the command firebase deploy consistently fails with the error:
Error: Failed to parse build specification: - FirebaseError Unexpected key extensions. You may need to install a newer version of the Firebase CLI.
This error is misleading and persists despite extensive troubleshooting, suggesting a deeper issue within the Firebase CLI's parsing mechanism or its interaction with the local environment, rather than a user configuration error.
Project Configuration (firebase.json):
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/thoth",
"function": "thoth"
}
]
},
"functions": [
{
"source": "functions",
"codebase": "default"
}
]
}
Function Code (functions/index.js):
const functions = require("firebase-functions");
exports.thoth = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Thoth!");
});
Troubleshooting Steps Performed:
The following steps were taken in an attempt to resolve the issue, none of which were successful:
- Validated Configuration: Manually inspected and validated the syntax of firebase.json and functions/package.json. No errors were found.
- Forced Dependency Refresh: Deleted functions/package-lock.json and ran deployment again to force a fresh installation of all function dependencies. The error persisted.
- Corrected File Corruption: Rewrote the firebase.json file to eliminate the possibility of hidden characters or file encoding issues. The error persisted.
- Updated firebase.json Schema: Converted the functions key in firebase.json from a JSON object to an array of objects, which is the more modern format. The error persisted.
- Updated Firebase CLI: Updated the Firebase CLI to the latest version globally using npm install -g firebase-tools. The error persisted even with the newest version.
- Isolated Configurations:
- Removed the rewrites section from hosting in firebase.json. The error persisted.
- Attempted to deploy only the functions using firebase deploy --only functions. The error persisted.
- Attempted to deploy a single, specific function using firebase deploy --only functions:thoth. The error persisted.
Expected Behavior:
- The firebase deploy command should successfully deploy the project's functions and hosting configurations.
Actual Behavior:
- The deployment process consistently terminates with the FirebaseError: Unexpected key extensions error message, regardless of the troubleshooting steps taken. This suggests the error message is not indicative of the actual problem and may be masking a more complex issue within the Firebase CLI.
Conclusion:
- Given the exhaustive troubleshooting, the issue does not appear to be with the project's configuration files. It is highly likely a bug within the Firebase CLI itself, related to its environment, caching, or how it parses project files on this specific machine.
Environment Details:
Firebase CLI Version: 13.10.0
Node.js Version: v20.18.1
Operating System: Linux firebase-aletheiacodex-web-1760544835208 6.6.105+ #1 SMP PREEMPT_DYNAMIC Tue Sep 23 09:51:10 UTC 2025 x86_64 GNU/Linux
functions/package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "20"
},
"main": "index.js",
"dependencies": {
"firebase-admin": "^11.0.1",
"firebase-functions": "^6.5.0"
},
"devDependencies": {
"firebase-functions-test": "^2.4.0"
},
"private": true
}
Project Configuration (firebase.json):
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/[redacted]",
"function": "[redacted]"
}
]
},
"functions": [
{
"source": "functions",
"codebase": "default"
}
]
}
Function Code (functions/index.js):
const functions = require("firebase-functions");
exports.thoth = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from [redacted]!");
});