New Site Not Deploying Despite Other Sites Functioning Smoothly

The problem arose during the recent deployment process when Netlify encountered difficulties deploying the Firebase functions. The specific error message displayed was: Error: Functions did not deploy properly. This is particularly perplexing since all other sites deployed without any problems.

I have meticulously reviewed the deployment settings and confirmed that they are consistent with the successful deployments of other sites. However, despite my efforts, the new deployment of Firebase functions seems to be failing consistently.

I am reaching out to seek assistance in understanding the root cause of this issue. Your expertise in this matter would be invaluable in helping me resolve the problem and achieve a successful deployment.

If there are any insights or suggestions you can provide, or if you require additional information from my end, please let me know. I am eager to get to the bottom of this and ensure a seamless deployment of Firebase functions on Netlify.

Netlify Site name: somthing.netlify.app

Build problems:

3:36:21 PM: Now using project something-db
3:36:21 PM: > deploy
3:36:21 PM: > firebase functions:config:set gmail.user=$GMAIL_USER gmail.pass=$GMAIL_PASS env.url=$REACT_APP_URL gapi.cred.email=$GAPI_CRED_EMAIL gapi.cred.key=$GAPI_CRED_KEY && firebase deploy --only functions,firestore
3:36:23 PM: ✔  Functions config updated.
3:36:23 PM: Please deploy your functions for the change to take effect by running firebase deploy --only functions
3:36:24 PM: === Deploying to 'something-db'...
3:36:24 PM: i  deploying firestore, functions
3:36:24 PM: i  firestore: reading indexes from firestore.indexes.json...
3:36:24 PM: i  cloud.firestore: checking firestore.rules for compilation errors...
3:36:25 PM: ✔  cloud.firestore: rules file firestore.rules compiled successfully
3:36:26 PM: ⚠  functions: package.json indicates an outdated version of firebase-functions.
3:36:26 PM: Please upgrade using npm install --save firebase-functions@latest in your functions directory.
3:36:26 PM: ⚠  functions: Please note that there will be breaking changes when you upgrade.
3:36:26 PM: i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
3:36:26 PM: i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
3:36:26 PM: ✔  functions: required API cloudfunctions.googleapis.com is enabled
3:36:26 PM: ✔  functions: required API cloudbuild.googleapis.com is enabled
3:36:27 PM: i  functions: preparing functions directory for uploading...
3:36:27 PM: i  functions: packaged functions (109.15 KB) for uploading
3:36:28 PM: i  firestore: latest version of firestore.rules already up to date, skipping upload...
3:36:29 PM: ✔  firestore: deployed indexes in firestore.indexes.json successfully
3:36:30 PM: ✔  functions: functions folder uploaded successfully
3:36:30 PM: ✔  firestore: released rules firestore.rules to cloud.firestore
3:36:30 PM: i  functions: updating Node.js 12 function checkNameUniqueness(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function collectionBackup(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function createUser(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function deleteUsers(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function onGenerateRamcisNumber(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function sendMail(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function storeBackup(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function updateUser(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function z_googleDriveFileQuery(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function addFileToPersonRecordOnUpload(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function onCreatePersonRecord(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function onDeletePersonRecord(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function onUserCreated(us-central1)...
3:37:03 PM: i  functions: updating Node.js 12 function onUserDeleted(us-central1)...
3:38:11 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:38:08 PM: i  functions: cleaning up build files...
3:38:10 PM: Functions deploy had errors with the following functions:
3:38:10 PM: 	checkNameUniqueness(us-central1)
3:38:10 PM: 	onUserCreated(us-central1)
3:38:10 PM: 	sendMail(us-central1)
3:38:10 PM: 	z_googleDriveFileQuery(us-central1)
3:38:10 PM: 	updateUser(us-central1)
3:38:10 PM: 	createUser(us-central1)
3:38:10 PM: 	collectionBackup(us-central1)
3:38:10 PM: 	onUserDeleted(us-central1)
3:38:10 PM: 	deleteUsers(us-central1)
3:38:10 PM: 	onCreatePersonRecord(us-central1)
3:38:10 PM: 	addFileToPersonRecordOnUpload(us-central1)
3:38:10 PM: 	onGenerateRamcisNumber(us-central1)
3:38:10 PM: 	onDeletePersonRecord(us-central1)
3:38:10 PM: 	storeBackup(us-central1)
3:38:10 PM: To try redeploying those functions, run:
3:38:10 PM:     firebase deploy --only functions:checkNameUniqueness,functions:onUserCreated,functions:sendMail,functions:z_googleDriveFileQuery,functions:updateUser,functions:createUser,functions:collectionBackup,functions:onUserDeleted,functions:deleteUsers,functions:onCreatePersonRecord,functions:addFileToPersonRecordOnUpload,functions:onGenerateRamcisNumber,functions:onDeletePersonRecord,functions:storeBackup
3:38:10 PM: To continue deploying other features (such as database), run:
3:38:10 PM:     firebase deploy --except functions
3:38:10 PM: Error: Functions did not deploy properly.
3:38:10 PM: ​
3:38:10 PM: build.command failed                                        
3:38:10 PM: ────────────────────────────────────────────────────────────────
3:38:10 PM: ​
3:38:10 PM:   Error message
3:38:10 PM:   Command failed with exit code 1: npm run validate-env && cd functions && npm install && npm run deploy && cd .. && CI= npm run build (https://ntl.fyi/exit-code-1)
3:38:10 PM: ​
3:38:10 PM:   Error location
3:38:10 PM:   In build.command from netlify.toml:
3:38:10 PM:   npm run validate-env && cd functions && npm install && npm run deploy && cd .. && CI= npm run build
3:38:10 PM: ​
3:38:10 PM:   Resolved config
3:38:10 PM:   build:
3:38:10 PM:     command: npm run validate-env && cd functions && npm install && npm run deploy && cd .. && CI= npm run build
3:38:10 PM:     commandOrigin: config
3:38:10 PM:     environment:
3:38:10 PM:       - FIREBASE_TOKEN
3:38:10 PM:       - GMAIL_PASS
3:38:10 PM:       - GMAIL_USER
3:38:10 PM:       - REACT_APP_ALLOW_MANUAL_RAMCIS_NUM_GENERATE
3:38:10 PM:       - REACT_APP_API_KEY
3:38:10 PM:       - REACT_APP_AUTH_DOMAIN
3:38:10 PM:       - REACT_APP_BUCKET
3:38:10 PM:       - REACT_APP_DATABASE_URL
3:38:10 PM:       - REACT_APP_MSG_SENDER_ID
3:38:10 PM:       - REACT_APP_OVERRIDE_ALLOW_ALL_MASTER_ACTIVITY_EDITS
3:38:10 PM:       - REACT_APP_PROJECT_ID
3:38:10 PM:       - REACT_APP_REPORT_ISSUES
3:38:10 PM:       - REACT_APP_URL
3:38:10 PM:     publish: /opt/build/repo/build
3:38:10 PM:     publishOrigin: config
3:38:10 PM:   functionsDirectory: /opt/build/repo/functions
3:38:10 PM:   headers:
3:38:10 PM:     - for: /*
      values:
        Referrer-Policy: no-referrer
        X-Content-Type-Options: nosniff
        X-Frame-Options: DENY
        X-XSS-Protection: 1; mode=block
  headersOrigin: config
  redirects:
    - from: /*
      status: 200
      to: /index.html
  redirectsOrigin: config
Caching artifacts
3:38:10 PM: Started saving node modules
3:38:10 PM: Finished saving node modules
3:38:10 PM: Started saving build plugins
3:38:10 PM: Finished saving build plugins
3:38:10 PM: Started saving corepack cache
3:38:10 PM: Finished saving corepack cache
3:38:10 PM: Started saving pip cache
3:38:10 PM: Finished saving pip cache
3:38:10 PM: Started saving emacs cask dependencies
3:38:11 PM: Finished saving emacs cask dependencies
3:38:11 PM: Started saving maven dependencies
3:38:11 PM: Finished saving maven dependencies
3:38:11 PM: Started saving boot dependencies
3:38:11 PM: Finished saving boot dependencies
3:38:11 PM: Started saving rust rustup cache
3:38:11 PM: Finished saving rust rustup cache
3:38:11 PM: Started saving go dependencies
3:38:11 PM: Finished saving go dependencies
3:38:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:38:11 PM: Failing build: Failed to build site
3:38:12 PM: Finished processing build request in 4m39.12s

We have no idea about Firebase Functions, how they deploy or work. There’s nothing we can help with in terms of deploying to Firebase. You should try reaching out to Firebase support.

I have just added the environment variable NODE_VERSION=12 and it resolved my building issue

Awesome thanks for coming back and sharing your solution!