How to authenticate with Trigger.dev so you can trigger tasks.
When you trigger a task from your backend code, you need to set the TRIGGER_SECRET_KEY
environment variable.
Each environment has its own secret key. You can find the value on the API keys page in the Trigger.dev dashboard:
To automatically configure the SDK with your secret key, you can set the TRIGGER_SECRET_KEY
environment variable. The SDK will automatically use this value when calling API methods (like trigger
).
You can do the same if you are self-hosting and need to change the default URL by using TRIGGER_API_URL
.
The default URL is https://api.trigger.dev
.
If you prefer to manually configure the SDK, you can call the configure
method: