Error when deploying Gen 1 Firebase function with no region set in config
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Environment
Nuxt 3.7.1 with Nitro 2.6.2
Reproduction
Hard to provide a reproduction since deployment is necessary to reproduce.
I have tested with older versions to find the root cause, and it seems that providing no region in firebase config will cause the error. Once I provided a region the error no longer occured.
Describe the bug
When deploying, all you will see in console is Error: An unexpected error has occurred.
After digging into the firebase-debug.log, you will see this error:
[debug] [2023-09-06T00:35:12.299Z] TypeError: Cannot read properties of null (reading 'match')
at resolveString (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/params.js:31:27)
at /usr/lib/node_modules/firebase-tools/lib/deploy/functions/params.js:47:36
at Array.map (<anonymous>)
at Object.resolveList (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/params.js:47:21)
at toBackend (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/build.js:180:30)
at Object.resolveBackend (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/build.js:73:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async prepare (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/prepare.js:68:62)
at async chain (/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:38:9)
at async deploy (/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:95:5)
Obviously this is not very helpful. After some trial and error, I discovered that the functions.yaml output was slightly different between v2.6.2 & v.2.5.2:
v2.6.2:
{
"endpoints": {
"server": {
"platform": "gcfv1",
"availableMemoryMb": null,
"timeoutSeconds": null,
"minInstances": null,
"maxInstances": null,
"ingressSettings": null,
"serviceAccountEmail": null,
"vpc": null,
"region": [
null
],
"httpsTrigger": {},
"entryPoint": "server"
}
},
"specVersion": "v1alpha1",
"requiredAPIs": []
}
v2.5.2:
{
"endpoints": {
"server": {
"platform": "gcfv1",
"availableMemoryMb": null,
"timeoutSeconds": null,
"minInstances": null,
"maxInstances": null,
"ingressSettings": null,
"serviceAccountEmail": null,
"vpc": null,
"httpsTrigger": {},
"entryPoint": "server"
}
},
"specVersion": "v1alpha1",
"requiredAPIs": []
}
As you can see, the older version did not have "region" defined at all while the new version has it set to [null] by default. After discovering this I set the region in the nitro config and sure enough it deployed without the same error.
Additional context
No response
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the deployment output functions.yaml is generated, comparing Nitro 2.6.2 with 2.5.2 and the region handling described in the report. Verify the Gen 1 Firebase deployment path when no region is configured; done means it no longer emits a [null] region or produces the reported Firebase error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, nuxtjs, typescript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100