fix(sdk): resolve ReferenceError in envvars.update outside task conte…#4265
fix(sdk): resolve ReferenceError in envvars.update outside task conte…#4265Rehansanjay wants to merge 1 commit into
Conversation
|
|
Hi @Rehansanjay, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe environment variable update implementation now checks that non-task-context names are strings before assigning them, throwing an error otherwise. A type-level test verifies that ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🔍 Pre-existing bug in the task-context branch assigns slug to projectRef
When taskContext.ctx is truthy and slugOrParams is a string (the 5-arg overload path), line 308 sets $projectRef = slugOrParams instead of $projectRef = projectRefOrName. This means the slug value gets used as the project reference. Line 309 then sets $slug = slugOrParams ?? taskContext.ctx.environment.slug which is correct in value but the ?? is dead code since slugOrParams is already confirmed to be a string (and thus truthy) by the typeof check on line 307.
This means that calling envvars.update("proj_ref", "dev", "MY_VAR", { value: "x" }) from inside a task context would send the API request with projectRef="dev" and slug="dev" instead of projectRef="proj_ref" and slug="dev". The PR fixes the analogous issue in the else branch but leaves this bug untouched.
(Refers to lines 308-309)
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
🔍 Missing changeset for public package modification
The AGENTS.md requires adding a changeset when modifying any public package (packages/*). This PR modifies packages/trigger-sdk/src/v3/envvars.ts but the .changeset/ directory only contains README.md and config.json (no changeset file). This should be added before merge per repository conventions.
Was this helpful? React with 👍 or 👎 to provide feedback.
…xt (#4264)
Closes #
✅ Checklist
Testing
[Describe the steps you took to test this change]
Changelog
[Short description of what has changed]
Screenshots
[Screenshots]
💯