Skip to content

fix: default task root#196

Merged
darklight3it merged 2 commits into
nodejs24.xfrom
fix/default-task-root
Jun 16, 2026
Merged

fix: default task root#196
darklight3it merged 2 commits into
nodejs24.xfrom
fix/default-task-root

Conversation

@darklight3it

@darklight3it darklight3it commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

Restore LAMBDA_TASK_ROOT fallback to process.cwd() for OCI runtime image customers.

The RIC 4.x refactoring introduced a hard requirement on the LAMBDA_TASK_ROOT environment variable, throwing a PlatformError when it's not set. This is a regression from RIC 3.x behavior where process.cwd() was used as the function root directory.

LAMBDA_TASK_ROOT is a restricted environment variable set by lambda worker environment to /var/task. Customers building custom runtime images via OCI cannot change this value, but were previously free to place their handler anywhere and rely on the working directory. The new strict check forces them to explicitly set LAMBDA_TASK_ROOT.

Changes

  • Fall back to process.cwd() when LAMBDA_TASK_ROOT is not set, restoring RIC 3.x behavior
  • Remove the now-unreachable PlatformError check for taskRoot (the fallback guarantees a value)
  • Add unit test covering the fallback behavior

Testing

  • Unit test verifying process.cwd() is used when LAMBDA_TASK_ROOT is unset
  • Existing tests continue to pass

Target (OCI, Managed Runtime, both): both

#184

Checklist

  • I have run npm install to generate the package-lock.json correctly and included it in the PR.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@darklight3it darklight3it self-assigned this Jun 12, 2026
Comment thread src/utils/runtime-setup.ts
Comment thread src/utils/runtime-setup.test.ts Outdated
Comment thread src/utils/runtime-setup.ts Outdated
@darklight3it darklight3it force-pushed the fix/default-task-root branch 3 times, most recently from d6dd716 to 731a2d8 Compare June 12, 2026 14:43
@darklight3it darklight3it force-pushed the fix/default-task-root branch from 731a2d8 to 9b9bca3 Compare June 12, 2026 14:52
@darklight3it darklight3it marked this pull request as ready for review June 12, 2026 14:52
@darklight3it darklight3it added the bug Something isn't working label Jun 12, 2026
@darklight3it darklight3it merged commit f86a7a8 into nodejs24.x Jun 16, 2026
3 checks passed
@benrkia benrkia deleted the fix/default-task-root branch June 16, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants