Skip to content

Can't deploy Nuxt Content v3 on Nuxt Hub when enabling NuxtStudio Api and Nitro OpenApi #3134

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

Open
sparrow-chik-chrk opened this issue Feb 15, 2025 · 8 comments
Labels

Comments

@sparrow-chik-chrk
Copy link

Environment

  • Operating System: Windows_NT
  • Node Version: v22.13.1
  • Nuxt Version: 3.15.4
  • CLI Version: 3.21.1
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: css, content, extends, devtools, experimental, fonts, future, hub, i18n, icon, image, modules, nitro, pages, primevue, runtimeConfig, vite, swiper, turnstile, typescript
  • Runtime Modules: @nuxt/[email protected], @nuxthub/[email protected]
  • Build Modules: -

Version

v3

Reproduction

Reproduction Steps:

  1. Create a Nuxt Project:

    • Run npx create-nuxt-app *name* and select the minimal configuration.
  2. Install Additional Dependencies:

    • Install @nuxthub/core and @nuxt/content:
      npm install @nuxthub/core @nuxt/content
  3. Update nuxt.config.js:

    • Modify the file to include:
      export default defineNuxtConfig({
        content: {
          preview: {
            api: 'https://api.nuxt.studio'
          }
        },
        modules: [        
          '@nuxt/content',
          '@nuxthub/core'
        ]
      }
  4. Attempt to Deploy via Nuxt Hub:

    • Build the project: npm run build
    • Deploy using Nuxt Hub (e.g., npx nuxt-hub deploy or following the official deployment instructions).

Expected Behavior:
The deployment succeeds without errors.

Actual Behavior:
Enabling the Nuxt Studio API triggers an error during deployment.

Description

When enabling the Nuxt Studio API in a minimal Nuxt project that includes nuxt-hub, nuxt, and @nuxt/content, the build or deployment fails with a Rollup error. The error message indicates that the identifier _C5GLGXMeta is declared more than once, which suggests a naming collision during the module import phase (likely between imports from @nuxt/content and nuxt-component-meta). This issue appears during Nitro’s prerendering process and prevents the project from building successfully.

Additional context

No response

Logs

[success] Server built in 1167ms
[info] [nitro] Initializing prerenderer
Error:  [nitro] RollupError: virtual:#nitro-internal-virtual/server-handlers-meta (20:7): Identifier "_C5GLGXMeta" has already been declared


18: import _nM4TMvMeta from "/home/runner/work/wiremit-landing/wiremit-landing/node_modules/@nuxt/content/dist/runtime/ap...
19: import _C5GLGXMeta from "/home/runner/work/wiremit-landing/wiremit-landing/node_modules/nuxt-component-meta/dist/runt...
20: import _C5GLGXMeta from "/home/runner/work/wiremit-landing/wiremit-landing/node_modules/nuxt-component-meta/dist/runt...
           ^
21: import _C5GLGXMeta from "/home/runner/work/wiremit-landing/wiremit-landing/node_modules/nuxt-component-meta/dist/runt...
22: import _FVWDacMeta from "/home/runner/work/wiremit-landing/wiremit-landing/node_modules/@nuxt/content/dist/runtime/pr...
Error:  virtual:#nitro-internal-virtual/server-handlers-meta (20:7): Identifier "_C5GLGXMeta" has already been declared
  at getRollupError (node_modules/rollup/dist/es/shared/parseAst.js:397:41)
  at error (node_modules/rollup/dist/es/shared/parseAst.js:393:42)
  at Module.error (node_modules/rollup/dist/es/shared/node-entry.js:16603:16)
  at Module.addImport (node_modules/rollup/dist/es/shared/node-entry.js:17167:22)
  at ImportDeclaration.initialise (node_modules/rollup/dist/es/shared/node-entry.js:12741:28)
  at convertNode (node_modules/rollup/dist/es/shared/node-entry.js:16006:10)
  at convertNodeList (node_modules/rollup/dist/es/shared/node-entry.js:16016:38)
  at Array.program (node_modules/rollup/dist/es/shared/node-entry.js:15866:21)
  at convertNode (node_modules/rollup/dist/es/shared/node-entry.js:16005:28)
  at convertProgram (node_modules/rollup/dist/es/shared/node-entry.js:15249:12) 

Error:  virtual:#nitro-internal-virtual/server-handlers-meta (20:7): Identifier "_C5GLGXMeta" has already been declared
Error: Process completed with exit code 1.
@farnabaz
Copy link
Member

@sparrow-chik-chrk Do you think you can provide a production repository?

This is strange, since the official documentation of the module is deployed on Nuxt Hub, and Nuxt Studio is enabled

@sparrow-chik-chrk
Copy link
Author

@farnabaz This conflict is specifically between Nuxt Studio and the Nitro experimental openAPI settings.
When I disabled openAPI, everything started working.

I had previously found a similar issue on GitHub, but it involved conflicts with completely different packages, so I initially didn’t pay attention to it.

@sparrow-chik-chrk sparrow-chik-chrk changed the title Can't deploy Nuxt Content v3 on Nuxt Hub when enabling Nuxt Studio Can't deploy Nuxt Content v3 on Nuxt Hub when enabling Nitro OpenApi Feb 22, 2025
@sparrow-chik-chrk sparrow-chik-chrk changed the title Can't deploy Nuxt Content v3 on Nuxt Hub when enabling Nitro OpenApi Can't deploy Nuxt Content v3 on Nuxt Hub when enabling NuxtStudio Api and Nitro OpenApi Feb 22, 2025
@farnabaz
Copy link
Member

This happens because Nitro does not check for hash uniqueness and Nuxt Component Meta module registers single handler for three apis. https://github.com/nuxtlabs/nuxt-component-meta/blob/0c79b54a289d3d6c7b96af50b7bbff963d0735e0/src/module.ts#L234-L248

I'll update Component Meta

farnabaz added a commit to nuxtlabs/nuxt-component-meta that referenced this issue Feb 24, 2025
@farnabaz
Copy link
Member

@sparrow-chik-chrk Just updated the Component meta module, I would appreciate if you could approve the fix before releasing

You can try by adding a resolution in package.json

"resolutions": {
    "nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@4f5fb93"
  }

@sparrow-chik-chrk
Copy link
Author

@sparrow-chik-chrk Just updated the Component meta module, I would appreciate if you could approve the fix before releasing

You can try by adding a resolution in package.json

"resolutions": {
    "nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@4f5fb93"
  }

Hi @farnabaz, thanks for the update. I tried adding the resolution in package.json as suggested, but I'm using pnpm, and it appears that pnpm doesn't support URL-based dependency specifications like "https://pkg.pr.new/nuxt-component-meta@4f5fb93". Unfortunately, this means the suggested resolution workaround doesn't work with our setup. Please let me know if there is another option to test this that might be compatible with pnpm.

@farnabaz
Copy link
Member

This is strange, I used the same resolution and checked with pnpm

  "resolutions": {
    "nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@4f5fb93"
  }
Image

@sparrow-chik-chrk
Copy link
Author

sparrow-chik-chrk commented Feb 24, 2025

@farnabaz
Then it might be a conflict due to the primevue package that I'm using...

Scope: all 2 workspace projects
 WARN  deprecated @primevue/[email protected]: This package has been deprecated, use @primeuix/themes instead.
 ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER  nuxt-component-meta@ https://pkg.pr.new/nuxt-component-meta@4f5fb93  isn't supported by any available resolver.

This error happened while installing the dependencies of @nuxt/[email protected]
Progress: resolved 73, reused 59, downloaded 8, added 0

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants