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 hidden exception in runNext #506

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

xxshady
Copy link
Contributor

@xxshady xxshady commented Sep 27, 2024

Abscence of return causes a hidden exception, which is handled by catch block and then passed to the reject callback while promise is already resolved

TypeError: Cannot read properties of undefined (reading 'then')
at:

value.then(nextVal => done ? resolve() : runNext(nextVal), reject);
   // ^

You can reproduce it by following this guide and running wasm component in nodejs with this handler (and yeah, "multipleResolves" event is deprecated but it's the only way I know of to observe this bug)

process.on('multipleResolves', (...args) =>{
  console.log('multipleResolves', args)
})

abscence of return caused a hidden exception, which was handled by `catch` block and then passed to the `reject` callback while promise was already resolved
@guybedford
Copy link
Collaborator

Thanks for fixing this!

@guybedford guybedford merged commit f0eabad into bytecodealliance:main Oct 1, 2024
11 of 16 checks passed
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.

2 participants