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

Improve error message when using async host functions with foreground plugins #41

Open
chrisdickinson opened this issue Dec 22, 2023 · 1 comment

Comments

@chrisdickinson
Copy link
Contributor

Since async host functions are only supported by plugins running on background threads, we should throw an early error if any host functions are instanceof AsyncFunction. Additionally, we should catch any "could not convert Promise to BigInt"-style errors that are emitted during runtime and wrap them with some help text.

@nilslice
Copy link
Member

Noting to anyone who finds this issue from an error message like:

SyntaxError: Cannot convert [object Promise] to a BigInt

async functions (or functions that explicitly return a promise) are only supported if runInWorker: true is passed to the plugin on initialization: https://github.com/extism/js-sdk/blob/main/examples/node.js#L15

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

No branches or pull requests

2 participants