Skip to content

Nuxt cloudflare-pages deployment fails #1346

@issue-up

Description

@issue-up

   Forwarded from downstream issue:


Environment

  • Operating System: Darwin
  • Node Version: v18.16.1
  • Nuxt Version: 3.6.0
  • Nitro Version: 2.5.1
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: devtools, modules, apollo
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://github.com/floatingpixels/nuxt-apollo.git

Describe the bug

I'm trying to deploy a Nuxt app to cloudflare pages. The app builds and runs fine locally, but the deployment to cloudflare pages fails. I'm using the Nuxt Apollo module, but I think the error might not be specific to the module, but has something to do with how Nuxt deploys on Cloudflare Pages. When deploying to Cloudflare pages I get the following error:

20:41:08.091 | [success] Server built in 1589ms
-- | --
20:41:08.108 | [success] [nitro] Generated public dist
20:41:08.168 | [info] [nitro] Building Nitro Server (preset: `cloudflare-pages`)
20:41:12.418 | (inject plugin) rollup-plugin-inject: failed to parse /opt/buildhome/repo/node_modules/graphql/jsutils/instanceOf.mjs. Consider restricting the plugin to particular files via options.include
20:41:12.421 | [error] [nitro] RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
20:41:12.422 |  
20:41:12.422 |  
20:41:12.422 | 10:   /* c8 ignore next 6 */
20:41:12.422 | 11:   // FIXME: https://github.com/graphql/graphql-js/issues/2317
20:41:12.423 | 12:   globalThis.process && globalThis.process.env.NODE_ENV === 'production'
20:41:12.423 | ^
20:41:12.423 | 13:     ? function instanceOf(value, constructor) {
20:41:12.423 | 14:         return value instanceof constructor;
20:41:12.424 | [error] Unexpected token (Note that you need plugins to import files that are not JavaScript)
20:41:12.425 | at error (node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
20:41:12.425 | at Module.error (node_modules/rollup/dist/es/shared/node-entry.js:13572:16)
20:41:12.425 | at Module.tryParse (node_modules/rollup/dist/es/shared/node-entry.js:14298:25)
20:41:12.425 | at Module.setSource (node_modules/rollup/dist/es/shared/node-entry.js:13899:39)
20:41:12.425 | at ModuleLoader.addModuleSource (node_modules/rollup/dist/es/shared/node-entry.js:24422:20)
20:41:12.472 | Failed: Error while executing user command. Exited with error code: 1
20:41:12.482 | Failed: build command exited with code: 1
20:41:13.591 | Failed: error occurred while running build command

This implies the build works fine, but rollup-plugin-inject fails to parse the graphql module. I'm not sure how to solve this, I searched through issues here in nuxt, and also over at nuxt apollo, but I don't know how to go about fixing this. Any help would be appreciated!

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions