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

fix(gatsby): resolve url file paths before reading #38854

Merged
merged 1 commit into from
Feb 20, 2024
Merged

Conversation

TylerBarnes
Copy link
Contributor

With esm source plugins, the stack trace util can't find the right path to read:

Sample trace of the problem where the real error is obscured

Error: ENOENT: no such file or directory, open 'file:///usr/src/app/www/node_modules/example-source-plugin/index.js'
    at Object.openSync (node:fs:600:3)
    at Object.readFileSync (node:fs:468:35)
    at getNonGatsbyCodeFrame (/usr/src/app/www/node_modules/gatsby/src/utils/stack-trace-utils.ts:74:19)
    at createNode (/usr/src/app/www/node_modules/gatsby/src/redux/actions/public.js:736:33)
    at /usr/src/app/www/node_modules/gatsby/src/redux/actions/public.js:835:21
    at /usr/src/app/www/node_modules/redux-thunk/lib/index.js:23:18
    at boundActionCreator (/usr/src/app/www/node_modules/redux/lib/redux.js:586:12)
    at Object.doubleBoundActionCreators.<computed> [as createNode] (/usr/src/app/www/node_modules/gatsby/src/utils/api-runner-node.js:108:20)
    at nodesApi.createNode (file:///usr/src/app/www/node_modules/example-source-plugin/index.js:573:49)
    at insertNode (file:///usr/src/app/www/node_modules/example-source-plugin/model/definition.js:423:28)
    at file:///usr/src/app/www/node_modules/example-source-plugin/model/definition.js:427:44
    at Array.map (<anonymous>)
    at Object.create (file:///usr/src/app/www/node_modules/example-source-plugin/model/definition.js:427:30)
    at file:///usr/src/app/www/src/index.ts:55:21
    at runNextModelInSlot (file:///usr/src/app/www/node_modules/example-source-plugin/model/builder.js:195:40)
    at Array.map (<anonymous>) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'file:///usr/src/app/www/node_modules/example-source-plugin/index.js'
}

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 16, 2024
@DanielSLew DanielSLew marked this pull request as ready for review February 16, 2024 19:39
@pieh pieh removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 20, 2024
@pieh pieh merged commit 2410754 into master Feb 20, 2024
32 of 35 checks passed
@pieh pieh deleted the fix/esm-stack-frame branch February 20, 2024 15:11
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

Successfully merging this pull request may close these issues.

3 participants