Closed paul-thebaud closed 3 months ago
That's quite weird. Did you reach out to Stackblitz?
I would assume they're not just running node - even though it looks like it when running node --version
. There's something different with the runtime leading to this issue.
@SBoudrias, thanks for your quick reply. As stated on the StackBlitz docs, web containers should provide "a native Node.js environment", so maybe this is not an issue on their side. I opened https://github.com/stackblitz/webcontainer-core/issues/1467 in addition to this issue.
It could be an issue with their environment support of Node.js async_hooks. It's been a recurring issue this year where support was lacking on platforms like Bun.
Specifically, async_hooks are tricky around timers. And so, core utilities to bind a callback to an async hooks context would be missing or broken in some platforms. Specifically, I think AsyncResource.bind
might be either missing or broken in their containers running Node.
Unrelated to this issue, I'm releasing performance improvements to Inquirer's loaders right right now. This will delay the start of animation, which maybe will fix that very specific issue you're running into 🤷🏻 (until you start doing async validation.)
Thank you a lot for that complete explication! 🙏 I'll try as soon as it get released!
According to this issue https://github.com/stackblitz/webcontainer-core/issues/1169#issuecomment-1698872854, you're right about async hooks.
@SBoudrias, Stackblitz issue has been closed in favor of already tracked https://github.com/stackblitz/webcontainer-core/issues/1169.
I suggested to leave this issue open so I can check out performance improvements and keep in touch 😉
@SBoudrias, I updated dependencies on the Stackblitz reproduction to check @inquirer/core
v8.2.3
, and error still appear :confused:
Is there any workaround?
The new inquirer (@inquirer/
) are heavily relying on AsyncLocalStorage
for everything; it won't work without.
The older API inquirer
is larger and less ergonomic, but it works without the hooks. So you could use that instead. This version is in maintenance mode.
Description
When using inside Stackblitz,
input
prompt will crash with the following error after user validate its choice for input:HookError: [Inquirer] Hook functions can only be called from within a prompt
Error does not show inside a "classical" environment. Error does not seems to show for all available prompts (tested
select
: no error).Reproduction
Go to this Stackblitz playground, run
node index.js
inside terminal and validate any answer for the input prompt.