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

[3.4.0] ESM, err_module_not_found: graphql/language/parser #2175

Closed
1 of 4 tasks
Tracked by #2441
belgattitude opened this issue Sep 14, 2022 · 6 comments
Closed
1 of 4 tasks
Tracked by #2441

[3.4.0] ESM, err_module_not_found: graphql/language/parser #2175

belgattitude opened this issue Sep 14, 2022 · 6 comments

Comments

@belgattitude
Copy link

belgattitude commented Sep 14, 2022

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the Codegen and plugins version under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

When upgrading to 3.4.0 from 3.3.0 in a nextjs with esmExternals enabled. I've tracked it down when upgrading graphql-mesh in this P/R. I hope it's well related to this package and that I don't create too much noise. Thanks for your time.

[WebServer] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/perso/perso/node_modules/graphql/language/parser' imported from /home/runner/work/perso/perso/node_modules/@graphql-inspector/core/index.mjs
Did you mean to import graphql/language/parser.js?
    at new NodeError (node:internal/errors:387:5)
    at finalizeResolution (node:internal/modules/esm/resolve:429:11)
    at moduleResolve (node:internal/modules/esm/resolve:1006:10)
    at defaultResolve (node:internal/modules/esm/resolve:1214:11)
    at nextResolve (node:internal/modules/esm/loader:165:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

To Reproduce Steps to reproduce the behavior:

Pull belgattitude/nextjs-monorepo-example#2604

yarn install
cd ./apps/nextjs-app
yarn build
yarn start

Then go to http://localhost:3000/api/gateway/graphql

image

PS: there's also an E2E test here

https://github.com/belgattitude/nextjs-monorepo-example/actions/runs/3082071761/jobs/4981334076 (Look for Error [ERR_MODULE_NOT_FOUND]).

image

Seems the error has exists since:

https://github.com/kamilkisiela/graphql-inspector/pull/2164/files#diff-f9827f191cd581d3c88ec472ffd00e90d00eab21d4e7525e7dbaeb78deab5018

Workaround

Lock resolutions to 3.3.0 in package.json

  "helpResolutions": {
    "@graphql-inspector/core": "https://github.com/kamilkisiela/graphql-inspector/issues/2175"
  },
  "resolutions": {
    "@graphql-inspector/core": "3.3.0"
  },

Expected behavior

Properly import the graphql/language/parser

Environment:

  • OS: Linux
  • @graphql-inspector/core: 3.4.0
  • graphql: 16.6.0
  • NodeJS: 16.17.0

Additional context

@ldiqual
Copy link

ldiqual commented Sep 22, 2022

I'm also experiencing this in an ESM context

@pixelis0x
Copy link

wen

@rachmari
Copy link

👋 We're also running into this issue. We're trying to upgrade from 3.1.2 -> 4.0.1 and get this same error. Changing the import statement in @graphql-inspector/core/index.mjs to import { Parser } from 'graphql/language/parser.js'; solved the issue.

@belgattitude
Copy link
Author

Seems to be fixed with 4.0.2. At least tested on nextjs 13.2.0. Thanks

@ldiqual
Copy link

ldiqual commented Apr 11, 2023

Fixed for us as well as of the last release.

@belgattitude
Copy link
Author

I'll close then. Thanks again

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

No branches or pull requests

4 participants