Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt3 with Web Frameworks fails to init or deploy - Cannot create property 'overrides' on string #7375

Closed
JamieCurnow opened this issue Jun 25, 2024 · 1 comment · Fixed by #7376

Comments

@JamieCurnow
Copy link
Contributor

[REQUIRED] Environment info

firebase-tools: 13.11.4

Platform: macOS

[REQUIRED] Test case

https://github.com/JamieCurnow/firebase-web-framework-nuxt-loadNuxtConfig

[REQUIRED] Steps to reproduce

This is a fresh nuxt install that was created using npx nuxi@latest init

Open the repo.
Run npm i to install deps.
Run firebase init --debug
Choose only Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys.
Use and existing project or create a new one.

[REQUIRED] Expected behavior

Firebase init sets up the firebase project for the repo.

[REQUIRED] Actual behavior

The command fails due to a recent(ish) update in nuxt/kit.

TypeError: Cannot create property 'overrides' on string '/Users/JCGeek/Documents/Projects/firebase-tools-issue/nuxt-app'
    at loadNuxtConfig (file:///Users/JCGeek/Documents/Projects/firebase-tools-issue/nuxt-app/node_modules/@nuxt/kit/dist/index.mjs:2581:18)
    at async getConfig (/Users/JCGeek/.nvm/versions/node/v20.14.0/lib/node_modules/firebase-tools/lib/frameworks/nuxt/index.js:92:12)
    at async discover (/Users/JCGeek/.nvm/versions/node/v20.14.0/lib/node_modules/firebase-tools/lib/frameworks/nuxt/index.js:28:37)
    at async discover (/Users/JCGeek/.nvm/versions/node/v20.14.0/lib/node_modules/firebase-tools/lib/frameworks/index.js:47:32)
    at async doSetup (/Users/JCGeek/.nvm/versions/node/v20.14.0/lib/node_modules/firebase-tools/lib/init/features/hosting/index.js:54:11)
    at async init (/Users/JCGeek/.nvm/versions/node/v20.14.0/lib/node_modules/firebase-tools/lib/init/index.js:39:9)

Research

It looks like firebase-tools is calling loadNuxtConfig(dir) here and passing in dir as a string.
In a recent Nuxt update that was made in PR here loadNuxtConfig now requires an object to be passed in.

Quick Fix

Downgrade nuxt to v3.11.2 - npm i [email protected], and explicitly install @nuxt/kit at 3.11.2 - npm i -D @nuxt/[email protected].
Run firebase init and it should work.

Actual fix

Pass an object through to loadNuxtConfig() - it seems as though passing the dir through has no affect at least in firebase init.

async function getConfig(dir) {
  const { loadNuxtConfig } = await (0, utils_1.relativeRequire)(dir, "@nuxt/kit")
  return await loadNuxtConfig({})
}

I'll test a deploy and put up a PR.

@JamieCurnow
Copy link
Contributor Author

PR here that fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants