Skip to content

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

Closed

Description

@JamieCurnow

[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.

Activity

  1. JamieCurnow commented on Jun 25, 2024

    @JamieCurnow
    ContributorAuthor

    PR here that fixes the issue.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions