I followed this tutorial for deploy my nuxt 3 project. This is how my firebase.json look like:
{
"functions": [
{
"source": ".output/server",
"runtime": "nodejs16"
}
],
"hosting": {
"public": ".output/public",
"cleanUrls": true,
"rewrites": [
{
"source": "**",
"function": "server"
}
],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
i also changed my nuxt.config.ts as follow:
export default defineNuxtConfig({
nitro: {
preset: 'firebase'
},
.....
then i run this script in package.json (i modified from tutorial, based my own requirement).
"deploy-fb": "cd .output/server && rm -rf node_modules && npm i && cd .. && firebase deploy",
But sadly, i got error
trace Error in firebase-debug.log like so,
[debug] [2024-03-06T17:37:51.732Z] Building nodejs source
[info] i functions: Loading and analyzing source code for codebase default to determine what to deploy
[debug] [2024-03-06T17:37:51.734Z] Could not find functions.yaml. Must use http discovery
[debug] [2024-03-06T17:37:51.743Z] Found firebase-functions binary at '/Users/julapps/web/gundu-web/.output/server/node_modules/.bin/firebase-functions'
[info] Serving at port 8566
[debug] [2024-03-06T17:37:53.072Z] Got response from /__/functions.yaml {"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":[]}
[debug] [2024-03-06T17:37:58.266Z] TypeError: Cannot read properties of null (reading 'match')
at resolveString (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/params.js:31:27)
at /Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/params.js:47:36
at Array.map (<anonymous>)
at Object.resolveList (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/params.js:47:21)
at toBackend (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/build.js:181:30)
at Object.resolveBackend (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/build.js:74:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async prepare (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/prepare.js:69:62)
at async chain (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/index.js:38:9)
at async deploy (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/index.js:95:5)
[error]
[error] Error: An unexpected error has occurred.
Please someone help me

After spent for almost three days, i found the solution of my case. This is because it has something was happened with the nitro https://github.com/nuxt/nuxt/issues/14439 After i checked carefully at debug.log file in folder
.output/serverthere was a dependency problem (in my case, there problem similarly like this https://github.com/npm/cli/issues/3711) and it is blocking the deployment process. So, what i did is deletingnode_modulesfolder in.output/serverthen runnpm installin there. If this process is success then execute deployment. Everything going well after that