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

syntax errors hang server #44

Closed
souporserious opened this issue Aug 26, 2021 · 3 comments · Fixed by #101
Closed

syntax errors hang server #44

souporserious opened this issue Aug 26, 2021 · 3 comments · Fixed by #101
Labels
good first issue Good for newcomers wontfix This will not be worked on

Comments

@souporserious
Copy link

Hello, thank you for this wonderful library! I'm currently using this in a Babel plugin and when testing with Jest it will hang and never complete the test if there's any sort of syntax error. Is there a way to surface these errors and kill the process if that happens? For example, you can just comment random code in runAsWorker and it should get stuck:

runAsWorker(async () => {
 abcd
})
@JounQin
Copy link
Member

JounQin commented Aug 28, 2021

@souporserious

Hi, this is a known limitation, only error in runAsWorker at runtime can be caught, a syntax error occurs on module loading, so it can not be handler at runtime. If hanging occurred, you can try SYNCKIT_TIMEOUT env to debug, problems mostly can be fixed on development.

PR welcome to add a notice section into README.

@JounQin JounQin closed this as completed Aug 28, 2021
@JounQin
Copy link
Member

JounQin commented Aug 28, 2021

It means the content of runAsWorker must be valid, but you can extract logic outside.

runAsWorker(async () => {
   const {} = await import('./may-have-syntax-error')
})

@JounQin JounQin added good first issue Good for newcomers wontfix This will not be worked on labels Aug 28, 2021
@souporserious
Copy link
Author

Ohhh, this is brilliant! Thank you! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants