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

Parcel error handling masks genuine issues #36371

Closed
2 tasks done
dan-kirkham opened this issue Aug 11, 2022 · 3 comments · Fixed by #36377
Closed
2 tasks done

Parcel error handling masks genuine issues #36371

dan-kirkham opened this issue Aug 11, 2022 · 3 comments · Fixed by #36377
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript type: bug An issue or pull request relating to a bug in Gatsby

Comments

@dan-kirkham
Copy link

Preliminary Checks

Description

This part of the code tries to compile the gatsby-config and seemingly sense check it.

// validate that output exists and is valid
try {
delete require.cache[bundle.filePath]
require(bundle.filePath)
} catch (e) {
if (retry >= RETRY_COUNT) {

There is a problem that it disregards any errors it receives. This caused a lot of confusion where out gatsby-config.ts file was doing something like:

// caused an error (missing quote)
const pathPrefix = JSON.parse('{"foo:"bar"}');

const config: GatsbyConfig = {
  jsxRuntime: "automatic",
  pathPrefix
};

return config;

Instead of logging sensible messages, we get the dreaded: Error: EBUSY: resource busy or locked, unlink 'C:\Users\...\.cache\.parcel-cache\data.mdb'.

Reproduction Link

https://github.com/gatsbyjs/gatsby/

Steps to Reproduce

  1. Add the following to gatsby-config.ts:
// caused an error (missing quote)
const pathPrefix = JSON.parse('{"foo:"bar"}');

const config: GatsbyConfig = {
  jsxRuntime: "automatic",
  pathPrefix
};

return config;
  1. Run gatsby dev
    ...

Expected Result

A clear error message that highlights the problem better (that the gatsby-config.ts threw an error)

Actual Result

Error: EBUSY: resource busy or locked error message, which is very misleading

Environment

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 AMD Ryzen 9 5950X 16-Core Processor            
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.2.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.47)
  npmPackages:
    gatsby: ^4.19.2 => 4.19.2 
    gatsby-cypress: 2.19.0 => 2.19.0 
    gatsby-plugin-google-tagmanager: ^4.19.0 => 4.19.0 
    gatsby-plugin-image: ^2.19.0 => 2.19.0 
    gatsby-plugin-newrelic: ^2.2.2 => 2.2.2 
    gatsby-plugin-sharp: ^4.19.0 => 4.19.0 
    gatsby-plugin-sitemap: ^5.19.0 => 5.19.0 
    gatsby-plugin-styled-components: ^5.19.0 => 5.19.0 
    gatsby-plugin-webpack-bundle-analyser-v2: 1.1.27 => 1.1.27 
    gatsby-source-filesystem: ^4.19.0 => 4.19.0 
    gatsby-transformer-remark: ^5.19.0 => 5.19.0 
    gatsby-transformer-sharp: ^4.19.0 => 4.19.0

Config Flags

No response

@dan-kirkham dan-kirkham added the type: bug An issue or pull request relating to a bug in Gatsby label Aug 11, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 11, 2022
@tyhopp
Copy link
Contributor

tyhopp commented Aug 12, 2022

Hi @dan-kirkham, sorry you experienced this issue. I was not able to reproduce using the latest stable (gatsby@4.20.0) and the version mentioned in issue description (gatsby@4.19.2).

Repo - https://github.com/tyhopp/gatsby-parcel-error-handling-36371

Can you link minimal reproduction? Thanks!

@tyhopp tyhopp added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 12, 2022
@dan-kirkham
Copy link
Author

Literally can repo off yours, I'm on a windows machine (potentially makes a difference?):

image

@pieh
Copy link
Contributor

pieh commented Aug 12, 2022

I'm on a windows machine (potentially makes a difference?):

Yes, that was important factor in being able to reproduce. I was able to reproduce and opened PR with proposed fix - #36377

@pieh pieh added status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript and removed status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. labels Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants