Skip to content

Commit 31c2a23

Browse files
authored
Docs improvements: clearing build cache, concurrently running next + trigger, trouble shooting pino (#1758)
* Adds “Explore by build extension” to the intro page * Adds instructions for clearing the build cache * Add a tip for running trigger dev + next dev concurrently * left align table headers * Adds trouble shooting for pino * Adds corepack bug and workaround * Removes reference to undici as it messes with spans * Left align table headers * Adds example for exporting logs to Axiom
1 parent 7b10d0b commit 31c2a23

File tree

9 files changed

+97
-5
lines changed

9 files changed

+97
-5
lines changed

docs/config/config-file.mdx

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ Some ones we recommend:
129129

130130
| Package | Description |
131131
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
132-
| `@opentelemetry/instrumentation-undici` | Logs all fetch calls (inc. Undici fetch) |
133132
| `@opentelemetry/instrumentation-http` | Logs all HTTP calls |
134133
| `@prisma/instrumentation` | Logs all Prisma calls, you need to [enable tracing](https://github.com/prisma/prisma/tree/main/packages/instrumentation) |
135134
| `@traceloop/instrumentation-openai` | Logs all OpenAI calls |
@@ -138,6 +137,37 @@ Some ones we recommend:
138137
`@opentelemetry/instrumentation-fs` which logs all file system calls is currently not supported.
139138
</Note>
140139

140+
### Exporters
141+
142+
You can also configure custom exporters to send your telemetry data to other services. For example, you can send your logs to [Axiom](https://axiom.co/docs/guides/opentelemetry-nodejs#exporter-instrumentation-ts):
143+
144+
```ts trigger.config.ts
145+
import { defineConfig } from "@trigger.dev/sdk/v3";
146+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
147+
148+
// Initialize OTLP trace exporter with the endpoint URL and headers
149+
const axiomExporter = new OTLPTraceExporter({
150+
url: 'https://api.axiom.co/v1/traces',
151+
headers: {
152+
'Authorization': `Bearer ${process.env.AXIOM_API_TOKEN}`,
153+
'X-Axiom-Dataset': process.env.AXIOM_DATASET
154+
},
155+
});
156+
157+
export default defineConfig({
158+
project: "<project ref>",
159+
// Your other config settings...
160+
telemetry: {
161+
instrumentations: [
162+
// Your instrumentations here
163+
],
164+
exporters: [axiomExporter],
165+
},
166+
});
167+
```
168+
169+
Make sure to set the `AXIOM_API_TOKEN` and `AXIOM_DATASET` environment variables in your project.
170+
141171
## Runtime
142172

143173
We currently only officially support the `node` runtime, but you can try our experimental `bun` runtime by setting the `runtime` option in your config file:

docs/deployment/overview.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebarTitle: "Overview"
44
description: "Learn how to deploy your tasks to Trigger.dev."
55
---
66

7+
import CorepackError from "/snippets/corepack-error.mdx";
8+
79
Before you can run production workloads on Trigger.dev, you need to deploy your tasks. The only way to do this at the moment is through the [deploy CLI command](/cli-deploy):
810

911
<CodeGroup>
@@ -231,3 +233,4 @@ export default defineConfig({
231233
},
232234
});
233235
```
236+
<CorepackError />

docs/guides/frameworks/nextjs.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import AddEnvironmentVariables from "/snippets/add-environment-variables.mdx";
1919
import DeployingYourTask from "/snippets/deplopying-your-task.mdx";
2020
import VercelDocsCards from "/snippets/vercel-docs-cards.mdx";
2121

22+
import RunDevAndNextConcurrently from "/snippets/run-dev-and-next-concurrently.mdx";
23+
2224
<Note>This guide can be followed for both App and Pages router as well as Server Actions.</Note>
2325

2426
<Prerequisites framework="Next.js" />
@@ -32,6 +34,8 @@ import VercelDocsCards from "/snippets/vercel-docs-cards.mdx";
3234
<CliViewRunStep />
3335
</Steps>
3436

37+
<RunDevAndNextConcurrently />
38+
3539
## Set your secret key locally
3640

3741
Set your `TRIGGER_SECRET_KEY` environment variable in your `.env.local` file if using the Next.js App router or `.env` file if using Pages router. This key is used to authenticate with Trigger.dev, so you can trigger runs from your Next.js app. Visit the API Keys page in the dashboard and select the DEV secret key.

docs/introduction.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ We provide everything you need to build and manage background tasks: a CLI and S
8585
<Card title="Firecrawl" img="/images/intro-firecrawl.jpg" href="/guides/examples/firecrawl-url-crawl"/>
8686
</CardGroup>
8787

88+
## Explore by build extension
89+
90+
| Extension | What it does | Docs |
91+
|:----------|:------------|:--------------|
92+
| prismaExtension | Use Prisma with Trigger.dev | [Learn more](/config/extensions/prismaExtension) |
93+
| pythonExtension | Execute Python scripts in Trigger.dev | [Learn more](/config/extensions/pythonExtension) |
94+
| puppeteer | Use Puppeteer with Trigger.dev | [Learn more](/config/extensions/puppeteer) |
95+
| ffmpeg | Use FFmpeg with Trigger.dev | [Learn more](/config/extensions/ffmpeg) |
96+
| aptGet | Install system packages with aptGet | [Learn more](/config/extensions/aptGet) |
97+
| additionalFiles | Copy additional files to the build directory | [Learn more](/config/extensions/additionalFiles) |
98+
| additionalPackages | Include additional packages in the build | [Learn more](/config/extensions/additionalPackages) |
99+
| syncEnvVars | Automatically sync environment variables to Trigger.dev | [Learn more](/config/extensions/syncEnvVars) |
100+
| esbuildPlugin | Add existing or custom esbuild plugins to your build process | [Learn more](/config/extensions/esbuildPlugin) |
101+
| emitDecoratorMetadata | Support for the emitDecoratorMetadata TypeScript compiler | [Learn more](/config/extensions/emitDecoratorMetadata) |
102+
| audioWaveform | Support for Audio Waveform in your project | [Learn more](/config/extensions/audioWaveform) |
88103

89104
## Getting help
90105

docs/logging.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ Tracing is a way to follow the flow of your code. It's very useful for debugging
3838
Trigger.dev uses OpenTelemetry tracing under the hood. With automatic tracing for many things like task triggering, task attempts, HTTP requests, and more.
3939

4040
| Name | Description |
41-
| ------------- | -------------------------------- |
42-
| Task triggers | Task triggers. |
43-
| Task attempts | Task attempts. |
41+
| :------------ | :------------------------------- |
42+
| Task triggers | Task triggers |
43+
| Task attempts | Task attempts |
4444
| HTTP requests | HTTP requests made by your code. |
4545

4646
### Adding instrumentations

docs/machines.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const config: TriggerConfig = {
3131
## Machine configurations
3232

3333
| Preset | vCPU | Memory | Disk space |
34-
| ------------------- | ---- | ------ | ---------- |
34+
| :------------------ | :--- | :----- | :--------- |
3535
| micro | 0.25 | 0.25 | 10GB |
3636
| small-1x (default) | 0.5 | 0.5 | 10GB |
3737
| small-2x | 1 | 1 | 10GB |

docs/snippets/corepack-error.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### `Cannot find matching keyid`
2+
3+
This error occurs when using Node.js v22 with corepack, as it's not yet compatible with the latest package manager signatures. To fix this, either:
4+
5+
1. Downgrade to Node.js v20 (LTS), or
6+
2. Install corepack globally: `npm i -g corepack@latest`
7+
8+
The corepack bug and workaround are detailed in [this issue](https://github.com/npm/cli/issues/8075).
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Tip>
2+
Instead of running your Next.js app and Trigger.dev dev server in separate terminals, you can run them concurrently. First, add these scripts to your `package.json`:
3+
4+
```json
5+
{
6+
"scripts": {
7+
"trigger:dev": "npx trigger.dev@latest dev",
8+
"dev": "npx concurrently --kill-others --names \"next,trigger\" --prefix-colors \"yellow,blue\" \"next dev\" \"npm run trigger:dev\""
9+
}
10+
}
11+
```
12+
13+
Then, in your terminal, you can start both servers with a single command:
14+
15+
```bash
16+
npm run dev
17+
```
18+
19+
This will run both your Next.js app and Trigger.dev dev server in the same terminal window, with color-coded output to distinguish between them.
20+
</Tip>

docs/troubleshooting.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description: "Some common problems you might experience and their solutions"
66
import NextjsTroubleshootingMissingApiKey from "/snippets/nextjs-missing-api-key.mdx";
77
import NextjsTroubleshootingButtonSyntax from "/snippets/nextjs-button-syntax.mdx";
88
import RateLimitHitUseBatchTrigger from "/snippets/rate-limit-hit-use-batchtrigger.mdx";
9+
import CorepackError from "/snippets/corepack-error.mdx";
910

1011
## Development
1112

@@ -29,6 +30,10 @@ Then change the permissions of the npm folder (if 1 doesn't work):
2930
sudo chown -R $(whoami) ~/.npm
3031
```
3132

33+
### Clear the build cache
34+
35+
Ensure you have stopped your local dev server then locate the hidden `.trigger` folder in your project and delete it. You can then restart your local dev server.
36+
3237
## Deployment
3338

3439
Running the [trigger.dev deploy] command builds and deploys your code. Sometimes there can be issues building your code.
@@ -63,6 +68,13 @@ export default defineConfig({
6368
});
6469
```
6570

71+
### `Cannot find module '/app/lib/worker.js"` when using pino
72+
73+
If you see this error, add pino (and any other associated packages) to your `external` build settings in your `trigger.config.ts` file. Learn more about the `external` setting in the [config docs](/config/config-file#external).
74+
75+
<CorepackError />
76+
77+
6678
## Project setup issues
6779

6880
### `The requested module 'node:events' does not provide an export named 'addAbortListener'`

0 commit comments

Comments
 (0)