4 out of 13 builds fail with: Build failed with status: EXPIRED and message: An unexpected error occurred
Environment info
firebase-tools: 13.13.1
Platform: Mac OS Sonoma 14.0
Test cases
1.
firebase experiments:disable functionsv2deployoptimizations
firebase deploy --only functions:main with a codebase containing 13 2nd generation Cloud Functions.
2
firebase experiments:enable functionsv2deployoptimizations
firebase deploy --only functions:main with a codebase containing 13 2nd generation Cloud Functions.
Steps to reproduce
Same as test cases
Expected behavior
All functions successfully deployed.
Actual behavior
In both cases, after running the above commands and waiting about 10 minutes, 4-5 of the functions will complete successfully fairly early in the build, then after a few more minutes, the rest fail with errors like this, then the messages saying a couple more successfully deployed, all together in one big chunk of logs at the end.:
Build failed with status: EXPIRED and message: An unexpected error occurred. Refer to build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/90e2bdef-d529-4dbe-be9e-355a18fc835e?project=1033623241793. For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=us-central1/90e2bdef-d529-4dbe-be9e-355a18fc835e?project=1033623241793.
The confusing thing is, in GCP Console, there's a ⚠️ sign on each function that errored and this is shown: Function is active, but the last deployment failed.
There is nothing useful in the build logs, as outlined in these two tickets: https://github.com/firebase/firebase-tools/issues/5967 & ~~https://github.com/firebase/firebase-tools/pull/5969~~ https://github.com/firebase/firebase-tools/issues/7268
This issue does not seem to follow the issue template. Make sure you provide all the required information.
This was seemingly fixed in https://github.com/firebase/firebase-tools/issues/7268 , however the fix seems to be a slow rollout.
I can confirm that on my end, I haven't had any issues since around July 4, but maybe the fix is still rolling out?
Ah yes, that was the issue I meant to reference above. I've updated my original comment.
Despite these two issues being resolved, I am still experiencing this problem.
I still have the issue https://github.com/firebase/firebase-tools/issues/7268
Name: functionsv2deployoptimizations Enabled: yes
tools v13.13.1
Hey folks, sorry to hear you’re still encountering this issue. I’m discussing this with our engineering team to see what could be causing the issue.
In the meantime, to unblock you from updating your functions, could you try deploying using firebase deploy --only functions:<function_name>, or firebase deploy --only functions:<codebase>:<function_name> if you're using codebases, for the functions which encountered an error.
Function is active, but the last deployment failed.
The function is still running and processing requests, however updating the function's code with the latest deployment failed. This means the function is still running the older version of the code.
I can confirm that deploying each function individually does result in a successful deployment. While this is a workaround, this level of hand-holding for each deploy is exactly optimal. Any idea when this will be fixed?
Any progress on this? It's still happening for me on every. single. deploy. I'm using 13.14.1 now.
This is also happening for our project of ~80 functions deployed across v1 and v2
Still happening for our project, approx 15 functions, deploying via GitHub actions using npx firebase-tools
Can we please get an update on this? Experimental flags aren't working. Deployment is incredibly slow too.
Fond a clue, in firebase-debug.log I noticed "Got source token undefined" before each failed build.
[debug] [2025-05-05T19:52:46.852Z] Got source token undefined for region europe-west1 [error] Build failed with status: EXPIRED and message: An unexpected error occurred. Refer to build logs: https://console.cloud.google.com/cloud-build/builds;region=europe-west1/ad854826-f716-489c-95ca-7f0f0b481e17?project=460783385512. For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=europe-west1/ad854826-f716-489c-95ca-7f0f0b481e17?project=460783385512.
Are you all also affected by https://github.com/firebase/firebase-tools/issues/6898? Could be related!
Closing this as it appears to have been caused by a backend regression that was since fixed. If you experience similar issues in the future, please open a new bug.