-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
The CLI crashes in Azure App Service windows & some other environments because of sandbox restrictions blocking system calls like os.userInfo. This is a common issue that several SDKs work around by wrapping os.userInfo in try/catch (see references below)
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOMEM (not enough memory)
at Object.userInfo (node:os:305:11)
The ENOMEM error is misleading - it's not actually a memory issue, but a sandbox restriction returning a generic error code to block the os.userInfo() syscall.
Is it possible to wrap the call in a try/catch? Here are sample workarounds for same issue by other SDKs:
- The function crashes with ENOMEM when requiring the SDK microsoft/cognitive-services-speech-sdk-js#405
- Azure Functions: A system error occurred: uv_os_get_passwd returned ENOMEM (not enough memory) Azure/azure-kusto-node#239
- Call to os.userInfo can lead to uncaught SystemError ionic-team/ionic-cli#4438
- Azure App service底下無法使用 eggjs/egg#2772 (comment)
I have tried this locally (e.g patching the JS) and the CLI runs well. Even if all tools do not work out-of-the-box (e.g. PS 7 is not installed in this environment), those can be configured by user and this would be very useful.
I can be found internally (karansin on Teams) and happy to discuss/contribute. Thanks!
Affected version
0.0.403
Steps to reproduce the behavior
- Create a relevant Azure resource that leverages the kudu sandbox (I used standard Logic App)
- Navigate to
https://YOUR-APP.scm.azurewebsites.net/DebugConsoleto open the developer console - Install copilot
- Run
copilot --version - See output below
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOMEM (not enough memory)
at Object.userInfo (node:os:305:11)
Expected behavior
If I patch this locally with a try/catch, I see the CLI executes.
Additional context
No response