question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v3.0.0-rc.12 - Google Firebase functions no longer generated by Nitro

See original GitHub issue

Environment


  • Operating System: Windows_NT
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: modules, ssr, nitro, app
  • Runtime Modules: @nuxt/content@2.1.1, @nuxtjs/tailwindcss@5.3.5, @pinia/nuxt@0.4.3, @nuxt/image-edge@1.0.0-27719579.87dcdf2
  • Build Modules: -

Reproduction

.

Describe the bug

I am hosting my Nuxt project on Google Firebase.

Since upgrading to v3.0.0-rc.12, npx nuxi build no longer generates functions properly in .output\server, despite setting the preset to Firebase with the following:

export default defineNuxtConfig({
  nitro: {
    preset: 'firebase'
  }
})

The issue also occurs if using NITRO_PRESET=firebase npm run build.

When attempting preview the project locally with firebase emulators:start, the following error occurs:

i  functions: Watching "C:\Users\<...>\<repo-name>\.output\server" for Cloud Functions...
The system cannot find the path specified.

Error: An unexpected error has occurred.

Hence, the project cannot be previewed locally or deployed.

Additional context

No response

Logs

From firebase-debug.log:

[debug] [2022-10-19T01:36:21.196Z] Building nodejs source
[debug] [2022-10-19T01:36:21.197Z] Analyzing nodejs backend spec
[debug] [2022-10-19T01:36:21.198Z] Could not find functions.yaml. Must use http discovery
[debug] [2022-10-19T01:36:21.223Z] Error: spawn ./node_modules/.bin/firebase-functions ENOENT
    at notFoundError (C:\Users\louis\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\louis\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\louis\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
[error] 
[error] Error: An unexpected error has occurred.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
Sandlenscommented, Oct 21, 2022

I have to run cd .output/server && rm -rf node_modules && npm i after each npx nuxi build, so no, this is only a workaround and it is not resolved I believe.

firebase-functions recently upgraded from v3 to v4 which included a number of breaking changes - I wonder whether this is causing any issues if Nitro is still based on v3?

5reactions
bituqcommented, Oct 19, 2022

A temporary solution that worked for me is to reinstall the node modules in the .output/folder directory:

cd .output/server && rm -rf node_modules && npm i

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage functions | Cloud Functions for Firebase - Google
If your project contains more than 5 functions, we recommend that you use the --only flag with specific function names to deploy only...
Read more >
Firebase Cloud Functions cannot read nitro generated index ...
It seems you are using the default node-server preset. To deploy the Nuxt 3 app to Firebase, you must set the NITRO_PRESET to...
Read more >
Cloud Functions release notes - Documentation
Google does not automatically update the base image in use for ... Emulator tool for Google Cloud Functions for Node 6 is no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found