Common problems
Some common problems you might experience and their solutions
Development
EACCES: permission denied
If you see this error:
First, clear the npm cache:
Then change the permissions of the npm folder (if 1 doesn’t work):
Deployment
Running the [trigger.dev deploy] command builds and deploys your code. Sometimes there can be issues building your code.
You can run the deploy command with --log-level debug
at the end. This will spit out a lot of information about the deploy. If you can’t figure out the problem from the information below please join our Discord and create a help forum post. Do NOT share the extended debug logs publicly as they might reveal private information about your project.
You can also review the build by supplying the --dry-run
flag. This will build your project but not deploy it. You can then inspect the build output on your machine.
Here are some common problems and their solutions:
Failed to build project image: Error building image
There should be a link below the error message to the full build logs on your machine. Take a look at these to see what went wrong. Join our Discord and you share it privately with us if you can’t figure out what’s going wrong. Do NOT share these publicly as the verbose logs might reveal private information about your project.
Deployment encountered an error
Usually there will be some useful guidance below this message. If you can’t figure out what’s going wrong then join our Discord and create a Help forum post with a link to your deployment.
Project setup issues
The requested module 'node:events' does not provide an export named 'addAbortListener'
If you see this error it means you’re not a supported version of Node:
You need to be on at least these minor versions:
Version | Minimum |
---|---|
18 | 18.20+ |
20 | 20.5+ |
21 | 21.0+ |
22 | 22.0+ |
Runtime issues
Environment variable not found:
Your code is deployed separately from the rest of your app(s) so you need to make sure that you set any environment variables you use in your tasks in the Trigger.dev dashboard. Read the guide.
Error: @prisma/client did not initialize yet.
Prisma uses code generation to create the client from your schema file. This means you need to add a bit of config so we can generate this file before your tasks run: Read the guide.
When triggering subtasks the parent task finishes too soon
Make sure that you always use await
when you call trigger
, triggerAndWait
, batchTrigger
, and batchTriggerAndWait
. If you don’t then it’s likely the task(s) won’t be triggered because the calling function process can be terminated before the networks calls are sent.
Rate limit exceeded
The most common cause of hitting the API rate limit is if you’re calling trigger()
on a task in a loop, instead of doing this use batchTrigger()
which will trigger multiple tasks in a single API call. You can have up to 100 tasks in a single batch trigger call.
View the rate limits page for more information.
Crypto is not defined
This can happen in different situations, for example when using plain strings as idempotency keys. Support for Crypto
without a special flag was added in Node v19.0.0
. You will have to upgrade Node - we recommend even-numbered major releases, e.g. v20
or v22
. Alternatively, you can switch from plain strings to the idempotencyKeys.create
SDK function. Read the guide.
Framework specific issues
NestJS swallows all errors/exceptions
If you’re using NestJS and you add code like this into your tasks you will prevent any errors from being surfaced:
NestJS has a global exception filter that catches all errors and swallows them, so we can’t receive them. Our current recommendation is to not use NestJS inside your tasks. If you’re a NestJS user you can still use Trigger.dev but just don’t use NestJS inside your tasks like this.
React is not defined
If you see this error:
Either add this to your file:
Or change the tsconfig jsx setting:
Next.js build failing due to missing API key in GitHub CI
This issue occurs during the Next.js app build process on GitHub CI where the Trigger.dev SDK is expecting the TRIGGER_SECRET_KEY environment variable to be set at build time. Next.js attempts to compile routes and creates static pages, which can cause issues with SDKs that require runtime environment variables. The solution is to mark the relevant pages as dynamic to prevent Next.js from trying to make them static. You can do this by adding the following line to the route file:
Correctly passing event handlers to React components
An issue can sometimes arise when you try to pass a function directly to the onClick
prop. This is because the function may require specific arguments or context that are not available when the event occurs. By wrapping the function call in an arrow function, you ensure that the handler is called with the correct context and any necessary arguments. For example:
This works:
Whereas this does not work:
Was this page helpful?