Skip to content

Call to os.userInfo blocks execution in Azure App Service environments #1511

@karanbirsingh

Description

@karanbirsingh

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:

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

  1. Create a relevant Azure resource that leverages the kudu sandbox (I used standard Logic App)
  2. Navigate to https://YOUR-APP.scm.azurewebsites.net/DebugConsole to open the developer console
  3. Install copilot
  4. Run copilot --version
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions