I'm getting the error "There was an error deploying functions" when trying to deploy a newly created function. There is no other error info in the output:
i functions: updating Node.js 22 (2nd Gen) function helloWorld(us-central1)...
Functions deploy had errors with the following functions:
helloWorld(us-central1)
Error: There was an error deploying functions
firebase functions:log
gives me nothing. The debug log has a not-very-helpful local stack trace at the end:
[2025-04-18T19:12:27.812Z] Functions deploy failed.
[2025-04-18T19:12:27.812Z] {}
[2025-04-18T19:12:27.849Z] Error: Precondition failed
at Fabricator.updateV2Function (/home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:382:19)
at Fabricator.updateEndpoint (/home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:155:24)
at /home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:110:71
at handle (/home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:89:23)
at Fabricator.applyChangeset (/home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:110:26)
at /home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:69:40
at Array.map (<anonymous>)
at Fabricator.applyPlan (/home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:68:54)
at release (/home/aldel/.nvm/versions/node/v20.15.1/lib/node_modules/firebase-tools/lib/deploy/functions/release/index.js:76:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: There was an error deploying functions
This is the first function in a new project, and it is literally just the helloWorld
function that firebase init
sets up (commented out; I just uncommented it):
import {onRequest} from "firebase-functions/v2/https";
import * as logger from "firebase-functions/logger";
export const helloWorld = onRequest((request, response) => {
logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});
The function works fine in the emulator.
How can I figure out what's wrong?