firebase-tools: Cannot deploy Angular SSR application using firebase deploy
[REQUIRED] Environment info
13.7.5
firebase-tools:
macOS / Ubuntu in GitHub Actions
Platform:
[REQUIRED] Test case
Deployment of Angular using Firebase Webframeworks fails due to runtimeClassName error
[REQUIRED] Steps to reproduce
- Create firebase project and upgrade it to blaze plan
- Create a new Angular Project using ng new. Select Y on the question to enable SSR
- Add Angularfire using ng add @angular/fire
- Enable ng deploy for hosting
- Without changes deploy hosting using ng deploy
[REQUIRED] Expected behavior
Deployment of hosting and SSR Function should work without problems.
[REQUIRED] Actual behavior
Deployment fails with result:
Error: Failed to replace Run service projects/123456789/locations/us-east1/services/ssrtestdeployxxxxxx
Google Cloud logging tells the following error
spec.template.spec.runtimeClassName: When annotation [run.googleapis.com/base-images] set, runtimeClassName must be set to run.googleapis.com/linux-base-image-update
About this issue
- Original URL
- State: open
- Created 2 months ago
- Reactions: 18
- Comments: 27 (1 by maintainers)
Commits related to this issue
- workaround https://github.com/firebase/firebase-tools/issues/7054 — committed to dasomx/mind-center by choipd 2 months ago
Same error here… for those in need to deploy immediately, disabling pintags
firebase experiments:disable pintagsbefore deploying should make it go through.No solution, but I found out what’s going on under the hood:
firebase-tools makes a GET request for the cloud run resource https://github.com/firebase/firebase-tools/blob/24accb1ad7773045808e78794f7c946cc60bb0bf/src/hosting/runTags.ts#L102
The result of that call contains the annotation
run.googleapis.com/base-imagesbut not theruntimeClassNameattribute. Afterwards the functionensureLatestRevisionTaggedhttps://github.com/firebase/firebase-tools/blob/24accb1ad7773045808e78794f7c946cc60bb0bf/src/hosting/runTags.ts#L144 modifies the resource and adds a tag.Instead of patching the cloud run service using a PATCH call, it uses a PUT call to replace the whole service resource. This PUT call fails with the mentioned error message, since the original result from the GET call above did include the annotation but not the
runtimeClassNameattribute.Not sure who to blame here, but I think two parties have bugs:
The cloud run http api should return the attribute
runtimeClassNamein the service template spec. The attribute is visible in the YAML view in the cloud console, but it’s not mentioned in the API docs https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#Servicefirebase-tools shouldn’t do a GET and a PUT. Instead it should use a PATCH request to to add the tag https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services/patch
[REQUIRED] Environment info
firebase-tools:
Platform: Fedora / Ubuntu
[REQUIRED] Test case
Deployment of Next app using Firebase Webframeworks fails due to runtimeClassName HTTP Error: 400
[REQUIRED] Steps to reproduce
firebase experiments:enable webframeworksfirebase deploy --project xxxx --debug[REQUIRED] Expected behavior
Update a new version next.js app
[REQUIRED] Actual behavior
Error:
Same situation as @Lzak deploying React + Next project.
Also running into this issue when trying to deploy my React + Next project.
Error: Failed to replace Run service projects/XXXXXX/locations/us-east1/services/ssrXXXXXX[REQUIRED] Environment info
Platform: macOS Ventura 13.5
package.json
[REQUIRED] Test case
Deployment of React+Next app using Firebase Webframeworks fails due to runtimeClassName HTTP Error: 400
[REQUIRED] Steps to reproduce
Create a Next.js project Execute firebase experiments:enable webframeworks Execute firebase deploy --debug
[REQUIRED] Expected behavior
Deploy the project along with the SSR function.
[REQUIRED] Actual behavior
Hey folks, thanks for all the information you shared, and apologies for the delay. Thanks @benediktarnold and @phminella for sharing your workarounds. I was able to reproduce the issue when setting the region to
europe-west3with pintags enabled. Let me try to bring someone from our team to look into this and provide more context.Another workaround: Use
us-central1oreurope-west1as the region forframeworksBackend. I tested both and didn’t have the problem. Initially I used europe-west3 and had the error.Explanation: The cloud run admin api behaves different depending on the region. Some regions return the annotation
run.googleapis.com/base-imagesfor the GET request and some don’t. So far I tested:Have the same issue when deploying Cloud Functions 2nd generation.
Same issue with Nextjs .Failed to replace Run service projects
This works for me, thank you.
report:
Hello,
I wanted to provide an update on my previous issue regarding the deployment of my Angular SSR Cloud Function in the europe-west3 region. Today, I retried
firebase experiments:disable pintags, and unlike yesterday, it worked successfully. I was able to deploy my function without encountering the error from before.Thank you for the support, and I hope this information might be helpful to others experiencing similar issues.
I get this issue when trying to add a Cloud SQL connection to Cloud Runs - this was working last week, seems like there was a change that impacts Cloud Run (Annotation logic)? This also seems to affect firebase then
Same issue, any solutions?
Same issue
spec.template.spec.runtimeClassName: When annotation [run.googleapis.com/base-images] set, runtimeClassName must be set to run.googleapis.com/linux-base-image-updateFail to finalize version
@Camille-D I got the same “Invalid Request. Violations: {runtime_update_policy=Base image update feature is not applicable to 2nd Gen functions.}” error while deploying 2nd Gen functions since a few minutes.
This not only applies to functions related to the Webframeworks but to all 2nd Gen Cloud Functions.
Does anyone have a fix yet?
Good catch! I have the error with
northamerica-northeast1andus-east1.Same issue in sveltekit deployment as well
Same issue as @Lzak from 14 hours ago.