Skip to content

Commit aca2f54

Browse files
authored
Docs - sync vercel env vars (#1426)
* Added sync env vars docs example * Added links in the config + deploy files * Updated copy * Added vercel docs cards and added them to all of the relevant docs pages * Added sync env vars to the intro page * Added automatically sync env vars section to nextjs guide * Added ‘Manually’ * Removed code block and updated title * updated formatting and added vercelsyncenvvars to the config file * Added missing comment * Updated imports to /core * Added sync env var docs link and note * Improved the VERCEL_ACCESS_TOKEN note * Added link to vercel * Updated docs and improved formatting * Copy tweaks * Added space * Updated deploy docs
1 parent 6313db6 commit aca2f54

10 files changed

+223
-37
lines changed

docs/config/config-file.mdx

+85-21
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ The `trigger.config.ts` file is used to configure your Trigger.dev project. It i
1313
import { defineConfig } from "@trigger.dev/sdk/v3";
1414

1515
export default defineConfig({
16-
//Your project ref (you can see it on the Project settings page in the dashboard)
17-
project: "proj_gtcwttqhhtlasxgfuhxs",
16+
// Your project ref (you can see it on the Project settings page in the dashboard)
17+
project: "<project ref>",
1818
//The paths for your trigger folders
1919
dirs: ["./trigger"],
2020
retries: {
@@ -55,7 +55,8 @@ You can add lifecycle functions to get notified when any task starts, succeeds,
5555
import { defineConfig } from "@trigger.dev/sdk/v3";
5656

5757
export default defineConfig({
58-
//..other stuff
58+
project: "<project ref>",
59+
// Your other config settings...
5960
onSuccess: async (payload, output, { ctx }) => {
6061
console.log("Task succeeded", ctx.task.id);
6162
},
@@ -87,7 +88,8 @@ import { PrismaInstrumentation } from "@prisma/instrumentation";
8788
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";
8889

8990
export default defineConfig({
90-
//..other stuff
91+
project: "<project ref>",
92+
// Your other config settings...
9193
instrumentations: [new PrismaInstrumentation(), new OpenAIInstrumentation()],
9294
});
9395
```
@@ -115,7 +117,8 @@ We currently only officially support the `node` runtime, but you can try our exp
115117
import { defineConfig } from "@trigger.dev/sdk/v3";
116118

117119
export default defineConfig({
118-
//..other stuff
120+
project: "<project ref>",
121+
// Your other config settings...
119122
runtime: "bun",
120123
});
121124
```
@@ -130,7 +133,8 @@ You can specify the default machine for all tasks in your project:
130133
import { defineConfig } from "@trigger.dev/sdk/v3";
131134

132135
export default defineConfig({
133-
//..other stuff
136+
project: "<project ref>",
137+
// Your other config settings...
134138
defaultMachine: "large-1x",
135139
});
136140
```
@@ -145,7 +149,8 @@ You can set the log level for your project:
145149
import { defineConfig } from "@trigger.dev/sdk/v3";
146150

147151
export default defineConfig({
148-
//..other stuff
152+
project: "<project ref>",
153+
// Your other config settings...
149154
logLevel: "debug",
150155
});
151156
```
@@ -160,7 +165,8 @@ You can set the default `maxDuration` for all tasks in your project:
160165
import { defineConfig } from "@trigger.dev/sdk/v3";
161166

162167
export default defineConfig({
163-
//..other stuff
168+
project: "<project ref>",
169+
// Your other config settings...
164170
maxDuration: 60, // 60 seconds
165171
});
166172
```
@@ -175,7 +181,8 @@ You can customize the build process using the `build` option:
175181
import { defineConfig } from "@trigger.dev/sdk/v3";
176182

177183
export default defineConfig({
178-
//..other stuff
184+
project: "<project ref>",
185+
// Your other config settings...
179186
build: {
180187
// Don't bundle these packages
181188
external: ["header-generator"],
@@ -197,7 +204,8 @@ All code is bundled by default, but you can exclude some packages from the bundl
197204
import { defineConfig } from "@trigger.dev/sdk/v3";
198205

199206
export default defineConfig({
200-
//..other stuff
207+
project: "<project ref>",
208+
// Your other config settings...
201209
build: {
202210
external: ["header-generator"],
203211
},
@@ -212,7 +220,8 @@ Each entry in the external should be a package name, not necessarily the import
212220
import { defineConfig } from "@trigger.dev/sdk/v3";
213221

214222
export default defineConfig({
215-
//..other stuff
223+
project: "<project ref>",
224+
// Your other config settings...
216225
build: {
217226
external: ["ai"],
218227
},
@@ -232,7 +241,8 @@ You can customize the `jsx` options that are passed to `esbuild` using the `jsx`
232241
import { defineConfig } from "@trigger.dev/sdk/v3";
233242

234243
export default defineConfig({
235-
//..other stuff
244+
project: "<project ref>",
245+
// Your other config settings...
236246
build: {
237247
jsx: {
238248
// Use the Fragment component instead of React.Fragment
@@ -258,7 +268,8 @@ You can add custom [import conditions](https://esbuild.github.io/api/#conditions
258268
import { defineConfig } from "@trigger.dev/sdk/v3";
259269

260270
export default defineConfig({
261-
//..other stuff
271+
project: "<project ref>",
272+
// Your other config settings...
262273
build: {
263274
conditions: ["react-server"],
264275
},
@@ -282,7 +293,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
282293
import { additionalFiles } from "@trigger.dev/build/extensions/core";
283294

284295
export default defineConfig({
285-
//..other stuff
296+
project: "<project ref>",
297+
// Your other config settings...
286298
build: {
287299
extensions: [
288300
additionalFiles({ files: ["wrangler/wrangler.toml", "./assets/**", "./fonts/**"] }),
@@ -304,7 +316,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
304316
import { additionalPackages } from "@trigger.dev/build/extensions/core";
305317

306318
export default defineConfig({
307-
//..other stuff
319+
project: "<project ref>",
320+
// Your other config settings...
308321
build: {
309322
extensions: [additionalPackages({ packages: ["wrangler"] })],
310323
},
@@ -317,7 +330,8 @@ This allows you to include additional packages in the build that are not automat
317330
import { defineConfig } from "@trigger.dev/sdk/v3";
318331

319332
export default defineConfig({
320-
//..other stuff
333+
project: "<project ref>",
334+
// Your other config settings...
321335
build: {
322336
extensions: [additionalPackages({ packages: ["[email protected]"] })],
323337
},
@@ -334,6 +348,7 @@ import { emitDecoratorMetadata } from "@trigger.dev/build/extensions/typescript"
334348

335349
export default defineConfig({
336350
project: "<project ref>",
351+
// Your other config settings...
337352
build: {
338353
extensions: [emitDecoratorMetadata()],
339354
},
@@ -365,6 +380,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
365380
import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
366381

367382
export default defineConfig({
383+
project: "<project ref>",
384+
// Your other config settings...
368385
build: {
369386
extensions: [
370387
prismaExtension({
@@ -389,6 +406,7 @@ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
389406

390407
export default defineConfig({
391408
project: "<project ref>",
409+
// Your other config settings...
392410
build: {
393411
extensions: [
394412
prismaExtension({
@@ -431,6 +449,7 @@ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
431449

432450
export default defineConfig({
433451
project: "<project ref>",
452+
// Your other config settings...
434453
build: {
435454
extensions: [
436455
prismaExtension({
@@ -451,6 +470,7 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
451470

452471
export default defineConfig({
453472
project: "<project ref>",
473+
// Your other config settings...
454474
build: {
455475
extensions: [
456476
prismaExtension({
@@ -473,6 +493,43 @@ These environment variables are only used during the build process and are not e
473493

474494
The `syncEnvVars` build extension replaces the deprecated `resolveEnvVars` export. Check out our [syncEnvVars documentation](/deploy-environment-variables#sync-env-vars-from-another-service) for more information.
475495

496+
```ts
497+
import { syncEnvVars } from "@trigger.dev/build/extensions/core";
498+
499+
export default defineConfig({
500+
project: "<project ref>",
501+
// Your other config settings...
502+
build: {
503+
extensions: [syncEnvVars()],
504+
},
505+
});
506+
```
507+
508+
#### vercelSyncEnvVars
509+
510+
The `vercelSyncEnvVars` build extension syncs environment variables from your Vercel project to Trigger.dev.
511+
512+
<Note>
513+
You need to set the `VERCEL_ACCESS_TOKEN` and `VERCEL_PROJECT_ID` environment variables, or pass
514+
in the token and project ID as arguments to the `vercelSyncEnvVars` build extension. You can find
515+
/ generate the `VERCEL_ACCESS_TOKEN` in your Vercel
516+
[dashboard](https://vercel.com/account/settings/tokens). Make sure the scope of the token covers
517+
the project you want to sync.
518+
</Note>
519+
520+
```ts
521+
import { defineConfig } from "@trigger.dev/sdk/v3";
522+
import { vercelSyncEnvVars } from "@trigger.dev/build/extensions/core";
523+
524+
export default defineConfig({
525+
project: "<project ref>",
526+
// Your other config settings...
527+
build: {
528+
extensions: [vercelSyncEnvVars()],
529+
},
530+
});
531+
```
532+
476533
#### audioWaveform
477534

478535
Previously, we installed [Audio Waveform](https://github.com/bbc/audiowaveform) in the build image. That's been moved to a build extension:
@@ -482,7 +539,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
482539
import { audioWaveform } from "@trigger.dev/build/extensions/audioWaveform";
483540

484541
export default defineConfig({
485-
//..other stuff
542+
project: "<project ref>",
543+
// Your other config settings...
486544
build: {
487545
extensions: [audioWaveform()], // uses verson 1.1.0 of audiowaveform by default
488546
},
@@ -525,6 +583,7 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
525583
import { ffmpeg } from "@trigger.dev/build/extensions/core";
526584

527585
export default defineConfig({
586+
project: "<project ref>",
528587
// Your other config settings...
529588
build: {
530589
extensions: [ffmpeg()],
@@ -539,7 +598,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
539598
import { ffmpeg } from "@trigger.dev/build/extensions/core";
540599

541600
export default defineConfig({
542-
//..other stuff
601+
project: "<project ref>",
602+
// Your other config settings...
543603
build: {
544604
extensions: [ffmpeg({ version: "6.0-4" })],
545605
},
@@ -561,6 +621,7 @@ import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
561621

562622
export default defineConfig({
563623
project: "<project ref>",
624+
// Your other config settings...
564625
build: {
565626
extensions: [
566627
esbuildPlugin(
@@ -586,7 +647,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
586647
import { aptGet } from "@trigger.dev/build/extensions/core";
587648

588649
export default defineConfig({
589-
//..other stuff
650+
project: "<project ref>",
651+
// Your other config settings...
590652
build: {
591653
extensions: [aptGet({ packages: ["ffmpeg"] })],
592654
},
@@ -599,7 +661,8 @@ If you want to install a specific version of a package, you can specify the vers
599661
import { defineConfig } from "@trigger.dev/sdk/v3";
600662

601663
export default defineConfig({
602-
//..other stuff
664+
project: "<project ref>",
665+
// Your other config settings...
603666
build: {
604667
extensions: [aptGet({ packages: ["ffmpeg=6.0-4"] })],
605668
},
@@ -646,7 +709,8 @@ Instead of creating this function and worrying about types, you can define an ex
646709
import { defineConfig } from "@trigger.dev/sdk/v3";
647710

648711
export default defineConfig({
649-
//..other stuff
712+
project: "<project ref>",
713+
// Your other config settings...
650714
build: {
651715
extensions: [
652716
{

docs/deploy-environment-variables.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ export default defineConfig({
123123
});
124124
```
125125

126+
#### Syncing environment variables from Vercel
127+
128+
To sync environment variables from your Vercel projects to Trigger.dev, you can use our build extension. Check out our [syncing environment variables from Vercel guide](/guides/examples/vercel-sync-env-vars).
129+
126130
#### Deploy
127131

128132
When you run the [CLI deploy command](/cli-deploy) directly or using [GitHub Actions](/github-actions) it will sync the environment variables from [Infisical](https://infisical.com) to Trigger.dev. This means they'll appear on the Environment Variables page so you can confirm that it's worked.

docs/guides/examples/vercel-ai-sdk.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebarTitle: "Vercel AI SDK"
44
description: "This example demonstrates how to use the Vercel AI SDK with Trigger.dev."
55
---
66

7+
import VercelDocsCards from "/snippets/vercel-docs-cards.mdx";
8+
79
## Overview
810

911
The [Vercel AI SDK](https://www.npmjs.com/package/ai) is a simple way to use AI models from many different providers, including OpenAI, Microsoft Azure, Google Generative AI, Anthropic, Amazon Bedrock, Groq, Perplexity and [more](https://sdk.vercel.ai/providers/ai-sdk-providers).
@@ -51,3 +53,5 @@ To test this task in the dashboard, you can use the following payload:
5153
"prompt": "What is the meaning of life?"
5254
}
5355
```
56+
57+
<VercelDocsCards />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: "Syncing environment variables from your Vercel projects"
3+
sidebarTitle: "Vercel sync environment variables"
4+
description: "This example demonstrates how to sync environment variables from your Vercel project to Trigger.dev."
5+
---
6+
7+
import VercelDocsCards from "/snippets/vercel-docs-cards.mdx";
8+
9+
## Overview
10+
11+
This example shows how to automatically sync environment variables from your Vercel project to Trigger.dev.
12+
13+
## Build configuration
14+
15+
To sync environment variables, you just need to add our build extension to your `trigger.config.ts` file. This extension will then automatically run every time you deploy your Trigger.dev project.
16+
17+
<Note>
18+
You need to set the `VERCEL_ACCESS_TOKEN` and `VERCEL_PROJECT_ID` environment variables in the
19+
Trigger.dev dashboard, or pass in the token and project ID as arguments to the `vercelSyncEnvVars`
20+
build extension. You can find / generate the `VERCEL_ACCESS_TOKEN` in your Vercel
21+
[dashboard](https://vercel.com/account/settings/tokens). Make sure the scope of the token covers
22+
the project with the environment variables you want to sync.
23+
</Note>
24+
25+
```ts trigger.config.ts
26+
import { defineConfig } from "@trigger.dev/sdk/v3";
27+
import { vercelSyncEnvVars } from "@trigger.dev/build/extensions/core";
28+
29+
export default defineConfig({
30+
project: "<project ref>",
31+
// Your other config settings...
32+
build: {
33+
// Add the vercelSyncEnvVars build extension
34+
extensions: [vercelSyncEnvVars()],
35+
},
36+
});
37+
```
38+
39+
<Note>
40+
[Build extensions](/config/config-file#extensions) allow you to hook into the build system and
41+
customize the build process or the resulting bundle and container image (in the case of
42+
deploying). You can use pre-built extensions or create your own.
43+
</Note>
44+
45+
## Running the sync operation
46+
47+
To sync the environment variables, all you need to do is run our `deploy` command. You should see some output in the console indicating that the environment variables have been synced, and they should now be available in your Trigger.dev dashboard.
48+
49+
```bash
50+
npx trigger.dev@latest deploy
51+
```
52+
53+
<VercelDocsCards />

docs/guides/frameworks/nextjs-webhooks.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebarTitle: "Next.js webhooks"
44
description: "Learn how to trigger a task from a webhook in a Next.js app."
55
---
66

7+
import VercelDocsCards from "/snippets/vercel-docs-cards.mdx";
8+
79
## Prerequisites
810

911
- [A Next.js project, set up with Trigger.dev](/guides/frameworks/nextjs)
@@ -135,3 +137,5 @@ If you now go to your [Trigger.dev dashboard](https://cloud.trigger.dev), you sh
135137
</Step>
136138

137139
</Steps>
140+
141+
<VercelDocsCards />

0 commit comments

Comments
 (0)