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: set customErrorInfo on zisi/esbuild errors #700

Merged
merged 8 commits into from Oct 6, 2021
Merged

Conversation

eduardoboucas
Copy link
Member

@eduardoboucas eduardoboucas commented Oct 4, 2021

- Summary

Adds a customErrorInfo property to errors arising from esbuild in ZISI.

- Test plan

Added new test.

@eduardoboucas eduardoboucas added the type: bug code to address defects in shipped code label Oct 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2021

⏱ Benchmark results

Comparing with 55b5529

largeDepsEsbuild: 10.8s

⬇️ 7.78% decrease vs. 55b5529

^                  12.6s          
│                   ┌──┐          
│  11.7s   11.1s    |  |          
│ ──┌──┐────┌──┐────┼──┼───10.8s──
│   |  |    |  |    |  |    ┌──┐  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴──>
    T-3     T-2     T-1      T    
Legend

largeDepsZisi: 57.5s

⬇️ 3.51% decrease vs. 55b5529

^                 1m 7.7s         
│                   ┌──┐          
│  59.5s            |  |          
│ ──┌──┐────59s─────┼──┼───57.5s──
│   |  |    ┌──┐    |  |    ┌──┐  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴──>
    T-3     T-2     T-1      T    
Legend

error.customErrorInfo = { type: 'functionsBundling', location: { functionName: name, runtime: RUNTIME_JS } }
error.customErrorInfo = {
type: 'functionsBundling',
location: { bundler: JS_BUNDLER_ESBUILD, functionName: name, runtime: RUNTIME_JS },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to show the bundler and/or the runtime in the error message title?

https://github.com/netlify/build/blob/a6ab7b9dbfebd21bcedcb5dbada4d1620cd6192a/packages/build/src/error/type.js#L86

Please note we do show the location fields in the error details, which is printed in the build logs. Also, the location fields are always sent to Bugsnag. Just wondering what you think about the error message title itself (which is shown in the error header and in the deploy summary).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't think we need to show the runtime in the message because it probably offers less clarity than the noise it introduces. I think that field is useful mostly for Bugsnag.

However, on that link I do see that we show functionName, which means that the field is mandatory. We don't have the function name when using esbuild from the ZISI flow. Adding it will mean passing that parameter around in a lot of functions, which I'm not super excited about, but it'll have to be done.

I'll add to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 94c3248. Some of these functions are called recursively, and without types it's a bit difficult to ensure all cases are covered, but I think I've done it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help! 🙌🏻

@kodiakhq kodiakhq bot merged commit b2bf035 into main Oct 6, 2021
@kodiakhq kodiakhq bot deleted the fix/bundling-errors branch October 6, 2021 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants