trigger.dev
trigger.dev copied to clipboard
bug: updating env from trigger v3 SDK
The SDK fails when I try to update env without a task context, with this error: ReferenceError: name is not defined
.
Here is my code with "@trigger.dev/sdk": "3.0.0-beta.48"
configure({ secretKey: process.env.TRIGGER_SECRET_KEY });
const triggerRes = await envvars.update(
process.env.TRIGGER_PROJECT_REF,
'dev',
accessTokenKey,
{ value: 'test' }
);
I think I found the issue and proposing the fix in this PR. I didn't test it and currently don't have the bandwidth to do so.
✅ Checklist
- [ ] I have followed every step in the contributing guide
- [ ] The PR title follows the convention.
- [ ] I ran and tested the code works
Testing
Calling the API directly with the same variables is successful.
Changelog
N/A
Screenshots
N/A
💯
Summary by CodeRabbit
-
New Features
- Enhanced validation for input parameters in the update function, ensuring that a name is required for successful execution.
-
Bug Fixes
- Improved error handling by throwing an error when the required name parameter is missing.