-
-
Notifications
You must be signed in to change notification settings - Fork 728
Docs - sync vercel env vars #1426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e74e16a
Added sync env vars docs example
D-K-P 7e7c02b
Added links in the config + deploy files
D-K-P ddc6b0f
Updated copy
D-K-P 9341e95
Merge branch 'main' into docs/vercel-sync-env-vars
D-K-P e98e701
Added vercel docs cards and added them to all of the relevant docs pages
D-K-P f701ea1
Added sync env vars to the intro page
D-K-P f075499
Added automatically sync env vars section to nextjs guide
D-K-P 21d41f2
Added ‘Manually’
D-K-P d0fa045
Removed code block and updated title
D-K-P 08f1ddb
updated formatting and added vercelsyncenvvars to the config file
D-K-P 45f3230
Added missing comment
D-K-P 251a1ee
Merge branch 'main' into docs/vercel-sync-env-vars
D-K-P 8fbbfd1
Updated imports to /core
D-K-P 04a3c44
Merge branch 'main' into docs/vercel-sync-env-vars
D-K-P 99507ba
Added sync env var docs link and note
D-K-P 478bdc6
Improved the VERCEL_ACCESS_TOKEN note
D-K-P 4224813
Added link to vercel
D-K-P bcc330d
Merge remote-tracking branch 'origin/main' into docs/vercel-sync-env-…
D-K-P 2335d26
Updated docs and improved formatting
D-K-P b71892c
Copy tweaks
D-K-P 9c402e0
Added space
D-K-P d3f6993
Updated deploy docs
D-K-P File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
|
||
export default defineConfig({ | ||
//Your project ref (you can see it on the Project settings page in the dashboard) | ||
project: "proj_gtcwttqhhtlasxgfuhxs", | ||
project: "<project ref>", | ||
//The paths for your trigger folders | ||
dirs: ["./trigger"], | ||
retries: { | ||
|
@@ -55,7 +55,8 @@ You can add lifecycle functions to get notified when any task starts, succeeds, | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
onSuccess: async (payload, output, { ctx }) => { | ||
console.log("Task succeeded", ctx.task.id); | ||
}, | ||
|
@@ -87,7 +88,8 @@ import { PrismaInstrumentation } from "@prisma/instrumentation"; | |
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
instrumentations: [new PrismaInstrumentation(), new OpenAIInstrumentation()], | ||
}); | ||
``` | ||
|
@@ -115,7 +117,8 @@ We currently only officially support the `node` runtime, but you can try our exp | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
runtime: "bun", | ||
}); | ||
``` | ||
|
@@ -130,7 +133,8 @@ You can specify the default machine for all tasks in your project: | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
defaultMachine: "large-1x", | ||
}); | ||
``` | ||
|
@@ -145,7 +149,8 @@ You can set the log level for your project: | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
logLevel: "debug", | ||
}); | ||
``` | ||
|
@@ -160,7 +165,8 @@ You can set the default `maxDuration` for all tasks in your project: | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
maxDuration: 60, // 60 seconds | ||
}); | ||
``` | ||
|
@@ -175,7 +181,8 @@ You can customize the build process using the `build` option: | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
// Don't bundle these packages | ||
external: ["header-generator"], | ||
|
@@ -197,7 +204,8 @@ All code is bundled by default, but you can exclude some packages from the bundl | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
external: ["header-generator"], | ||
}, | ||
|
@@ -212,7 +220,8 @@ Each entry in the external should be a package name, not necessarily the import | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
external: ["ai"], | ||
}, | ||
|
@@ -232,7 +241,8 @@ You can customize the `jsx` options that are passed to `esbuild` using the `jsx` | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
jsx: { | ||
// Use the Fragment component instead of React.Fragment | ||
|
@@ -258,7 +268,8 @@ You can add custom [import conditions](https://esbuild.github.io/api/#conditions | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
conditions: ["react-server"], | ||
}, | ||
|
@@ -282,7 +293,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
import { additionalFiles } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
additionalFiles({ files: ["wrangler/wrangler.toml", "./assets/**", "./fonts/**"] }), | ||
|
@@ -304,7 +316,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
import { additionalPackages } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [additionalPackages({ packages: ["wrangler"] })], | ||
}, | ||
|
@@ -317,7 +330,8 @@ This allows you to include additional packages in the build that are not automat | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [additionalPackages({ packages: ["[email protected]"] })], | ||
}, | ||
|
@@ -334,6 +348,7 @@ import { emitDecoratorMetadata } from "@trigger.dev/build/extensions/typescript" | |
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [emitDecoratorMetadata()], | ||
}, | ||
|
@@ -365,6 +380,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
import { prismaExtension } from "@trigger.dev/build/extensions/prisma"; | ||
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
prismaExtension({ | ||
|
@@ -389,6 +406,7 @@ import { prismaExtension } from "@trigger.dev/build/extensions/prisma"; | |
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
prismaExtension({ | ||
|
@@ -431,6 +449,7 @@ import { prismaExtension } from "@trigger.dev/build/extensions/prisma"; | |
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
prismaExtension({ | ||
|
@@ -451,6 +470,7 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
prismaExtension({ | ||
|
@@ -473,6 +493,43 @@ These environment variables are only used during the build process and are not e | |
|
||
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. | ||
|
||
```ts | ||
import { syncEnvVars } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [syncEnvVars()], | ||
}, | ||
}); | ||
``` | ||
|
||
#### vercelSyncEnvVars | ||
|
||
The `vercelSyncEnvVars` build extension syncs environment variables from your Vercel project to Trigger.dev. | ||
|
||
D-K-P marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Note> | ||
You need to set the `VERCEL_ACCESS_TOKEN` and `VERCEL_PROJECT_ID` environment variables, or pass | ||
in the token and project ID as arguments to the `vercelSyncEnvVars` build extension. You can find | ||
/ generate the `VERCEL_ACCESS_TOKEN` in your Vercel | ||
[dashboard](https://vercel.com/account/settings/tokens). Make sure the scope of the token covers | ||
the project you want to sync. | ||
</Note> | ||
|
||
```ts | ||
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
import { vercelSyncEnvVars } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [vercelSyncEnvVars()], | ||
}, | ||
}); | ||
``` | ||
|
||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+508
to
+532
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance Vercel sync documentation with examples. Consider adding:
|
||
#### audioWaveform | ||
|
||
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"; | |
import { audioWaveform } from "@trigger.dev/build/extensions/audioWaveform"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [audioWaveform()], // uses verson 1.1.0 of audiowaveform by default | ||
}, | ||
|
@@ -525,6 +583,7 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
import { ffmpeg } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ffmpeg()], | ||
|
@@ -539,7 +598,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
import { ffmpeg } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ffmpeg({ version: "6.0-4" })], | ||
}, | ||
|
@@ -561,6 +621,7 @@ import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin"; | |
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
esbuildPlugin( | ||
|
@@ -586,7 +647,8 @@ import { defineConfig } from "@trigger.dev/sdk/v3"; | |
import { aptGet } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [aptGet({ packages: ["ffmpeg"] })], | ||
}, | ||
|
@@ -599,7 +661,8 @@ If you want to install a specific version of a package, you can specify the vers | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [aptGet({ packages: ["ffmpeg=6.0-4"] })], | ||
}, | ||
|
@@ -646,7 +709,8 @@ Instead of creating this function and worrying about types, you can define an ex | |
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
|
||
export default defineConfig({ | ||
//..other stuff | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
extensions: [ | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: "Syncing environment variables from your Vercel projects" | ||
sidebarTitle: "Vercel sync environment variables" | ||
description: "This example demonstrates how to sync environment variables from your Vercel project to Trigger.dev." | ||
--- | ||
|
||
import VercelDocsCards from "/snippets/vercel-docs-cards.mdx"; | ||
|
||
## Overview | ||
|
||
This example shows how to automatically sync environment variables from your Vercel project to Trigger.dev. | ||
|
||
## Build configuration | ||
|
||
To sync environment variables from your Vercel project to Trigger.dev, you just need to add this build configuration to your `trigger.config.ts` file. This extension will then automatically run every time you deploy your project. | ||
|
||
This code syncs encrypted environment variables, filtering them based on the current environment (production, preview, or development). | ||
|
||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Note> | ||
You need to set the `VERCEL_ACCESS_TOKEN` and `VERCEL_PROJECT_ID` environment variables, or pass | ||
in the token and project ID as arguments to the `vercelSyncEnvVars` build extension. You can find | ||
/ generate the `VERCEL_ACCESS_TOKEN` in your Vercel | ||
[dashboard](https://vercel.com/account/settings/tokens). Make sure the scope of the token covers | ||
the project you want to sync. | ||
</Note> | ||
|
||
```ts trigger.config.ts | ||
import { defineConfig } from "@trigger.dev/sdk/v3"; | ||
import { vercelSyncEnvVars } from "@trigger.dev/build/extensions/core"; | ||
|
||
export default defineConfig({ | ||
project: "<project ref>", | ||
// Your other config settings... | ||
build: { | ||
// Add the vercelSyncEnvVars build extension | ||
extensions: [vercelSyncEnvVars()], | ||
}, | ||
}); | ||
``` | ||
|
||
<Note> | ||
[Build extensions](/config/config-file#extensions) allow you to hook into the build system and | ||
customize the build process or the resulting bundle and container image (in the case of | ||
deploying). You can use pre-built extensions or create your own. | ||
</Note> | ||
|
||
## Running the sync operation | ||
|
||
To run the sync operation, simply run the `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 the Trigger.dev dashboard. | ||
|
||
```bash | ||
npx trigger.dev@latest deploy | ||
``` | ||
|
||
<VercelDocsCards /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.