stackblitz / webcontainer-core

Dev environments. In your web app.
https://webcontainers.io
MIT License
3.93k stars 172 forks source link

bug: inquirer prompt throws an error in terminal #1467

Closed paul-thebaud closed 5 months ago

paul-thebaud commented 5 months ago

Describe the bug

When using inside Stackblitz, Inquirer 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).

Link to the blitz that caused the error

https://stackblitz.com/edit/stackblitz-starters-rlkfig?file=index.js

Steps to reproduce

  1. Open terminal
  2. Run node index.js

Expected behavior

Script should just log the filled name.

Parity with Local

Screenshots

No response

Platform

Browser name  = Chrome
Full version  = 126.0.0.0
Major version = 126
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 84316330,
  "usedJSHeapSize": 66940810,
  "jsHeapSizeLimit": 4294705152
}
Hash = 802dc1bc

Additional context

An issue is already opened on Inquirer : https://github.com/SBoudrias/Inquirer.js/issues/1426 The package maintainer find that weird and think it is a Stackblitz Web container issue.

jrvidal commented 5 months ago

:wave: Thanks for the report. This is a known limitation of WebContainer, as it does not support AsyncLocalStorage.

I'm going to close this in favor or https://github.com/stackblitz/webcontainer-core/issues/1169, where it was already discussed in some detail.