Whenever I try to deploy my Angular Universal app, the hosting gets deployed without issue, but I'm faced with the following error whenever I run ng deploy:
Functions did not deploy properly.
Everything functions without error when I run npm run build:ssr though, so I'm not sure what is causing this error. Here is my firebase.json file:
{
"hosting": [
{
"target": "iquench-website",
"public": "dist\\dist\\browser",
"ignore": [
"**/.*"
],
"headers": [
{
"source": "*.[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].+(css|js)",
"headers": [
{
"key": "Cache-Control",
"value": "public,max-age=31536000,immutable"
}
]
}
],
"rewrites": [
{
"source": "**",
"function": "ssr"
}
]
}
],
"functions": {
"source": "dist"
}
}
and my .firebaserc:
{
"projects": {
"default": "PROJECT_NAME"
},
"targets": {
"PROJECT_NAME": {
"hosting": {
"iquench-website": [
"PROJECT_NAME"
]
}
}
}
}
Here are the logs when deploying:
=== Deploying to 'PROJECT_NAME'...
i deploying functions, hosting
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
+ functions: required API cloudfunctions.googleapis.com is enabled
+ functions: required API cloudbuild.googleapis.com is enabled
i functions: preparing dist directory for uploading...
i functions: packaged dist (5.72 MB) for uploading
+ functions: dist folder uploaded successfully
i hosting[PROJECT_NAME]: beginning deploy...
i hosting[PROJECT_NAME]: found 115 files in dist\dist\browser
+ hosting[PROJECT_NAME]: file upload complete
i functions: current functions in project: backupFirestore(us-central1), deleteUser(us-central1), ssr(us-central1)
i functions: uploading functions in project: ssr(us-central1)
i functions: updating Node.js 10 function ssr(us-central1)...
+ scheduler: required API cloudscheduler.googleapis.com is enabled
! functions[ssr(us-central1)]: Deployment error.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Functions deploy had errors with the following functions:
ssr
To try redeploying those functions, run:
firebase deploy --only "functions:ssr"
To continue deploying other features (such as database), run:
firebase deploy --except functions
Functions did not deploy properly.