firebase-tools: Nuxt3 Error - Failed to find location of Firebase Functions SDK
[REQUIRED] Environment info
firebase-tools: 11.22.0
Platform: Windows
[REQUIRED] Test case
npx firebase deploy
[REQUIRED] Steps to reproduce
The error occurs when using a nuxt v3.1.1 app in a monorepo.
First I build the app for production with npx cross-env NITRO_PRESET=firebase npm run build
Then I deploy on Firebase Hosting with npx firebase deploy
Here is my firebase.json
:
{
"functions": [
{
"source": ".output/server",
"codebase": "nuxt"
},
{
"source": "functions",
"codebase": "functions",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
}
],
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": ".output/public",
"cleanUrls": true,
"rewrites": [{ "source": "**", "function": "server" }],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
[REQUIRED] Expected behavior
Before upgrading to firebase-tools 11.22.0, I used 11.21.0 version. I was able to deploy on Firebase Hosting (although I was facing the https://github.com/firebase/firebase-tools/issues/4952 issue and used the fix mentionned in the thread).
[REQUIRED] Actual behavior
I get following error :
Error: Failed to find location of Firebase Functions SDK. Please file a bug on Github (https://github.com/firebase/firebase-tools/).
The content of firebase-debug.log
:
[debug] [2023-02-01T22:01:08.076Z] ---------------------------------------------------------------------- [debug] [2023-02-01T22:01:08.082Z] Command: C:\Program Files\nodejs\node.exe C:\Users\plsch\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy --debug flag [debug] [2023-02-01T22:01:08.084Z] CLI Version: 11.22.0 [debug] [2023-02-01T22:01:08.084Z] Platform: win32 [debug] [2023-02-01T22:01:08.084Z] Node Version: v16.16.0 [debug] [2023-02-01T22:01:08.086Z] Time: Wed Feb 01 2023 23:01:08 GMT+0100 (heure normale d’Europe centrale) [debug] [2023-02-01T22:01:08.087Z] ---------------------------------------------------------------------- [debug] [error] [error] Error: Too many arguments. Run firebase help deploy for usage instructions
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 21 (1 by maintainers)
@rensvis Sorry, I may have been unclear. Currently there are two tooling strategies to get a Nuxt 3 app on firebase and both don’t work properly:
.output/server
folder and donpm install
. Then you can usefirebase deploy
to publish the app. This solution is of course contrary to tracing by nitro and increases the package load. My fix for nitro would solve this problem though.A function for nuxt would no longer need to be entered, as this would be handled by firebase cli. In my example I have only given another function folder as an example for further firebase functions. You can now simply use the firebase cli for building the app:
However, I still ran into a few problems that I’m trying to solve in my pull request.
I hope this helps to understand a little better what the current state of nuxt3 and firebase interaction is and what solutions are currently available.
Same here.
My config
And after running firebase deploy --debug
This is also a Nuxt 3 setup, with present Firebase.
I was able to fix this, but all I did was delete my functions directory and do a
firebase init --only functions
and it fixed all the issues for me. Of course, I am also using codebases format so myfirebase.json
looks like so:This bug is a tracing error in unjs/nitro. It may be possible to fix this with a different packaging strategy on the firebase side but I don’t know about that. I have already made a fix for nuxt: https://github.com/unjs/nitro/pull/627
In addition, you can now also use the following firebase config:
If you specify the nuxt app folder under “source”, then firebase builds the app and that works fine for me.