Skip to content

Commit 5fe23e4

Browse files
authored
Troubleshooting guide (docs) (#1139)
* Started troubleshooting guide * More work on the troubleshooting guide * NestJS troubleshooting and using await when triggering * Fleshed out more * Added Prisma * Tweaks
1 parent 7b3b2e0 commit 5fe23e4

File tree

2 files changed

+104
-76
lines changed

2 files changed

+104
-76
lines changed

docs/mint.json

Lines changed: 21 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
{
22
"$schema": "https://mintlify.com/schema.json",
33
"name": "Trigger.dev",
4-
"openapi": [
5-
"/openapi.yml",
6-
"/v3-openapi.yaml"
7-
],
8-
"versions": [
9-
"v3 (Developer Preview)",
10-
"v2"
11-
],
4+
"openapi": ["/openapi.yml", "/v3-openapi.yaml"],
5+
"versions": ["v3 (Developer Preview)", "v2"],
126
"api": {
137
"playground": {
148
"mode": "hide"
@@ -102,19 +96,12 @@
10296
{
10397
"group": "",
10498
"version": "v3 (Developer Preview)",
105-
"pages": [
106-
"v3/introduction"
107-
]
99+
"pages": ["v3/introduction"]
108100
},
109101
{
110102
"group": "Getting Started",
111103
"version": "v3 (Developer Preview)",
112-
"pages": [
113-
"v3/quick-start",
114-
"v3/upgrading-from-v2",
115-
"v3/changelog",
116-
"v3/feature-matrix"
117-
]
104+
"pages": ["v3/quick-start", "v3/upgrading-from-v2", "v3/changelog", "v3/feature-matrix"]
118105
},
119106
{
120107
"group": "Fundamentals",
@@ -126,21 +113,15 @@
126113
"v3/apikeys",
127114
{
128115
"group": "Task types",
129-
"pages": [
130-
"v3/tasks-regular",
131-
"v3/tasks-scheduled"
132-
]
116+
"pages": ["v3/tasks-regular", "v3/tasks-scheduled"]
133117
},
134118
"v3/trigger-config"
135119
]
136120
},
137121
{
138122
"group": "Development",
139123
"version": "v3 (Developer Preview)",
140-
"pages": [
141-
"v3/cli-dev",
142-
"v3/run-tests"
143-
]
124+
"pages": ["v3/cli-dev", "v3/run-tests"]
144125
},
145126
{
146127
"group": "Deployment",
@@ -151,9 +132,7 @@
151132
"v3/github-actions",
152133
{
153134
"group": "Deployment integrations",
154-
"pages": [
155-
"v3/vercel-integration"
156-
]
135+
"pages": ["v3/vercel-integration"]
157136
}
158137
]
159138
},
@@ -222,16 +201,13 @@
222201
{
223202
"group": "Open source",
224203
"version": "v3 (Developer Preview)",
225-
"pages": [
226-
"v3/github-repo",
227-
"v3/open-source-self-hosting",
228-
"v3/open-source-contributing"
229-
]
204+
"pages": ["v3/github-repo", "v3/open-source-self-hosting", "v3/open-source-contributing"]
230205
},
231206
{
232207
"group": "Troubleshooting",
233208
"version": "v3 (Developer Preview)",
234209
"pages": [
210+
"v3/troubleshooting",
235211
"v3/troubleshooting-alerts",
236212
"v3/troubleshooting-uptime-status",
237213
"v3/troubleshooting-github-issues",
@@ -241,11 +217,7 @@
241217
{
242218
"group": "Help",
243219
"version": "v3 (Developer Preview)",
244-
"pages": [
245-
"v3/community",
246-
"v3/help-slack",
247-
"v3/help-email"
248-
]
220+
"pages": ["v3/community", "v3/help-slack", "v3/help-email"]
249221
},
250222
{
251223
"group": "Getting Started",
@@ -437,10 +409,7 @@
437409
"pages": [
438410
{
439411
"group": "Airtable",
440-
"pages": [
441-
"integrations/apis/airtable",
442-
"integrations/apis/airtable-tasks"
443-
]
412+
"pages": ["integrations/apis/airtable", "integrations/apis/airtable-tasks"]
444413
},
445414
{
446415
"group": "GitHub",
@@ -466,25 +435,16 @@
466435
},
467436
{
468437
"group": "Plain",
469-
"pages": [
470-
"integrations/apis/plain",
471-
"integrations/apis/plain-tasks"
472-
]
438+
"pages": ["integrations/apis/plain", "integrations/apis/plain-tasks"]
473439
},
474440
"integrations/apis/replicate",
475441
{
476442
"group": "SendGrid",
477-
"pages": [
478-
"integrations/apis/sendgrid",
479-
"integrations/apis/sendgrid-tasks"
480-
]
443+
"pages": ["integrations/apis/sendgrid", "integrations/apis/sendgrid-tasks"]
481444
},
482445
{
483446
"group": "Resend",
484-
"pages": [
485-
"integrations/apis/resend",
486-
"integrations/apis/resend-tasks"
487-
]
447+
"pages": ["integrations/apis/resend", "integrations/apis/resend-tasks"]
488448
},
489449
{
490450
"group": "Shopify",
@@ -496,10 +456,7 @@
496456
},
497457
{
498458
"group": "Slack",
499-
"pages": [
500-
"integrations/apis/slack",
501-
"integrations/apis/slack-tasks"
502-
]
459+
"pages": ["integrations/apis/slack", "integrations/apis/slack-tasks"]
503460
},
504461
"integrations/apis/stripe",
505462
{
@@ -525,9 +482,7 @@
525482
"sdk/triggerclient/constructor",
526483
{
527484
"group": "Instance properties",
528-
"pages": [
529-
"sdk/triggerclient/store"
530-
]
485+
"pages": ["sdk/triggerclient/store"]
531486
},
532487
{
533488
"group": "Instance methods",
@@ -590,10 +545,7 @@
590545
"sdk/dynamictrigger/constructor",
591546
{
592547
"group": "Instance methods",
593-
"pages": [
594-
"sdk/dynamictrigger/register",
595-
"sdk/dynamictrigger/unregister"
596-
]
548+
"pages": ["sdk/dynamictrigger/register", "sdk/dynamictrigger/unregister"]
597549
}
598550
]
599551
},
@@ -604,10 +556,7 @@
604556
"sdk/dynamicschedule/constructor",
605557
{
606558
"group": "Instance methods",
607-
"pages": [
608-
"sdk/dynamicschedule/register",
609-
"sdk/dynamicschedule/unregister"
610-
]
559+
"pages": ["sdk/dynamicschedule/register", "sdk/dynamicschedule/unregister"]
611560
}
612561
]
613562
},
@@ -620,9 +569,7 @@
620569
{
621570
"group": "HTTP Reference",
622571
"version": "v2",
623-
"pages": [
624-
"sdk/api-reference/events/create-an-event"
625-
]
572+
"pages": ["sdk/api-reference/events/create-an-event"]
626573
},
627574
{
628575
"group": "React SDK",
@@ -638,14 +585,12 @@
638585
{
639586
"group": "Overview",
640587
"version": "v2",
641-
"pages": [
642-
"examples/introduction"
643-
]
588+
"pages": ["examples/introduction"]
644589
}
645590
],
646591
"footerSocials": {
647592
"twitter": "https://twitter.com/triggerdotdev",
648593
"github": "https://github.com/triggerdotdev",
649594
"linkedin": "https://www.linkedin.com/company/triggerdotdev"
650595
}
651-
}
596+
}

docs/v3/troubleshooting.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: "Common problems"
3+
description: "Some common problems you might experience and their solutions"
4+
---
5+
6+
## Deployment
7+
8+
Running the [trigger.dev deploy] command builds and deploys your code. Sometimes there can be issues building your code.
9+
10+
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](https://trigger.dev/discord) and create a help forum post. Do NOT share the extended debug logs publicly as they might reveal private information about your project.
11+
12+
Here are some common problems and their solutions:
13+
14+
### `Typecheck failed, aborting deployment`
15+
16+
We typecheck your code before deploying. If the typecheck fails, the deployment is aborted. You should see logs with details about the typecheck failure.
17+
18+
You can skip typechecking, by adding the `--skip-typecheck` flag when calling deploy.
19+
20+
### `Error: Cannot find module 'X'`
21+
22+
This errors occurs if we can't figure out how to automatically import some code. You can fix this by adding it to the `dependenciesToBundle` array in the [trigger.config file](/v3/trigger-config).
23+
24+
Like this:
25+
26+
```ts trigger.config.ts
27+
import type { TriggerConfig } from "@trigger.dev/sdk/v3";
28+
29+
export const config: TriggerConfig = {
30+
//..other stuff
31+
//either regex or strings of package names
32+
dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"],
33+
};
34+
```
35+
36+
### `Failed to build project image: Error building image`
37+
38+
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](https://trigger.dev/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.
39+
40+
### `Deployment timed out`
41+
42+
The last stage of deployment is to run it on our servers – we register the new versions of your tasks with the dashboard during this step. We allow 3 mins for this to succeed or fail. If it fails then you'll see this error.
43+
44+
The first thing to do is to try again. If that fails then join [our Discord](https://trigger.dev/discord) and create a Help forum post with a link to your deployment.
45+
46+
### `Deployment encountered an error`
47+
48+
Usually there will be some useful guidance below this message. If you can't figure out what's going wrong then join [our Discord](https://trigger.dev/discord) and create a Help forum post with a link to your deployment.
49+
50+
## Runtime issues
51+
52+
### `Environment variable not found:`
53+
54+
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](/v3/deploy-environment-variables).
55+
56+
### `Error: @prisma/client did not initialize yet.`
57+
58+
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](/v3/trigger-config#prisma-and-other-generators).
59+
60+
### When triggering subtasks the parent task finishes too soon
61+
62+
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.
63+
64+
## Framework specific issues
65+
66+
### NestJS swallows all errors/exceptions
67+
68+
If you're using NestJS and you add code like this into your tasks you will prevent any errors from being surfaced:
69+
70+
```ts
71+
export const simplestTask = task({
72+
id: "nestjs-example",
73+
run: async (payload) => {
74+
//by doing this you're swallowing any errors
75+
const app = await NestFactory.createApplicationContext(AppModule);
76+
await app.init();
77+
78+
//etc...
79+
},
80+
});
81+
```
82+
83+
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.

0 commit comments

Comments
 (0)