You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/config-file.mdx
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,7 @@ Some ones we recommend:
105
105
106
106
## Runtime
107
107
108
-
We currently only official support the `node` runtime, but you can try our expirimental`bun` runtime by setting the `runtime` option in your config file:
108
+
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:
@@ -453,7 +453,11 @@ These environment variables are only used during the build process and are not e
453
453
454
454
</Note>
455
455
456
-
#### `audioWaveform`
456
+
#### syncEnvVars
457
+
458
+
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.
459
+
460
+
#### audioWaveform
457
461
458
462
Previously, we installed [Audio Waveform](https://github.com/bbc/audiowaveform) in the build image. That's been moved to a build extension:
459
463
@@ -469,7 +473,7 @@ export default defineConfig({
469
473
});
470
474
```
471
475
472
-
#### `ffmpeg`
476
+
#### ffmpeg
473
477
474
478
You can add the `ffmpeg` build extension to your build process:
475
479
@@ -528,7 +532,7 @@ export default defineConfig({
528
532
});
529
533
```
530
534
531
-
#### `aptGet`
535
+
#### aptGet
532
536
533
537
You can install system packages into the deployed image using using the `aptGet` extension:
When you [develop locally](/cli-dev)`resolveEnvVars()` will inject the env vars from [Infisical](https://infisical.com) into your local `process.env`.
140
-
141
126
#### Deploy
142
127
143
128
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.
144
129
145
130
This means that you need to redeploy your Trigger.dev tasks if you change the environment variables in [Infisical](https://infisical.com).
146
131
147
-
### The variables return type
132
+
<Note>
133
+
The `process.env.INFISICAL_CLIENT_ID`, `process.env.INFISICAL_CLIENT_SECRET` and
134
+
`process.env.INFISICAL_PROJECT_ID` will need to be supplied to the `deploy` CLI command. You can
135
+
do this via the `--env-file .env` flag or by setting them as environment variables in your
136
+
terminal.
137
+
</Note>
138
+
139
+
#### Dev
148
140
149
-
You can return `variables` as an object with string keys and values, or an array of names + values.
141
+
`syncEnvVars` does not have any effect when running the `dev` command locally. If you want to inject environment variables from another service into your local environment you can do so via a `.env` file or just supplying them as environment variables in your terminal. Most services will have a CLI tool that allows you to run a command with environment variables set:
142
+
143
+
```sh
144
+
infisical run -- npx trigger.dev@latest dev
145
+
```
146
+
147
+
Any environment variables set in the CLI command will be available to your local Trigger.dev tasks.
148
+
149
+
### The syncEnvVars callback return type
150
+
151
+
You can return env vars as an object with string keys and values, or an array of names + values.
150
152
151
153
```ts
152
154
return {
153
-
variables: {
154
-
MY_ENV_VAR: "my value",
155
-
MY_OTHER_ENV_VAR: "my other value",
156
-
},
155
+
MY_ENV_VAR: "my value",
156
+
MY_OTHER_ENV_VAR: "my other value",
157
157
};
158
158
```
159
159
160
160
or
161
161
162
162
```ts
163
-
return {
164
-
variables: [
165
-
{
166
-
name: "MY_ENV_VAR",
167
-
value: "my value",
168
-
},
169
-
{
170
-
name: "MY_OTHER_ENV_VAR",
171
-
value: "my other value",
172
-
},
173
-
],
174
-
};
163
+
return [
164
+
{
165
+
name: "MY_ENV_VAR",
166
+
value: "my value",
167
+
},
168
+
{
169
+
name: "MY_OTHER_ENV_VAR",
170
+
value: "my other value",
171
+
},
172
+
];
175
173
```
176
174
177
175
This should mean that for most secret services you won't need to convert the data into a different format.
@@ -184,11 +182,11 @@ Securely pass a Google credential JSON file to your Trigger.dev task using envir
184
182
185
183
<Steptitle="Convert the Google credential file to base64">
186
184
187
-
In your terminal, run the following command and copy the resulting base64 string:
185
+
In your terminal, run the following command and copy the resulting base64 string:
Copy file name to clipboardExpand all lines: docs/github-actions.mdx
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -99,14 +99,14 @@ If you already have a GitHub action file, you can just add the final step "🚀
99
99
100
100
## Version pinning
101
101
102
-
The CLI and `@trigger.dev/*` package versions need to be in sync, otherwise there will be errors and unpredictable behavior. Hence, the `deploy` command will automatically fail during CI on any version mismatches.
102
+
The CLI and `@trigger.dev/*` package versions need to be in sync with the `trigger.dev` CLI, otherwise there will be errors and unpredictable behavior. Hence, the `deploy` command will automatically fail during CI on any version mismatches.
103
103
Tip: add the deploy command to your `package.json` file to keep versions managed in the same place. For example:
We now have experimental support for Bun. This guide will show you have to setup Trigger.dev in your existing Bun project, test an example task, and view the run.
13
+
14
+
<Warn>
15
+
The trigger.dev CLI does not yet support Bun. So you will need to run the CLI using Node.js. But
16
+
Bun will still be used to execute your tasks, even in the `dev` environment.
17
+
</Warn>
18
+
19
+
<Prerequisitesframework="Bun" />
20
+
21
+
## Initial setup
22
+
23
+
<Steps>
24
+
<Steptitle="Run the CLI `init` command">
25
+
26
+
The easiest way to get started is to use the CLI. It will add Trigger.dev to your existing project, create a `/trigger` folder and give you an example task.
27
+
28
+
Run this command in the root of your project to get started:
29
+
30
+
<CodeGroup>
31
+
32
+
```bash npm
33
+
npx trigger.dev@latest init --runtime bun
34
+
```
35
+
36
+
```bash pnpm
37
+
pnpm dlx trigger.dev@latest init --runtime bun
38
+
```
39
+
40
+
```bash yarn
41
+
yarn dlx trigger.dev@latest init --runtime bun
42
+
```
43
+
44
+
</CodeGroup>
45
+
46
+
It will do a few things:
47
+
48
+
1. Log you into the CLI if you're not already logged in.
49
+
2. Create a `trigger.config.ts` file in the root of your project.
50
+
3. Ask where you'd like to create the `/trigger` directory.
51
+
4. Create the `/src/trigger` directory with an example task, `/src/trigger/example.[ts/js]`.
52
+
53
+
Install the "Hello World" example task when prompted. We'll use this task to test the setup.
54
+
55
+
</Step>
56
+
57
+
<Steptitle="Update example.ts to use Bun">
58
+
59
+
Open the `/src/trigger/example.ts` file and replace the contents with the following:
60
+
61
+
```ts example.ts
62
+
import { Database } from"bun:sqlite";
63
+
import { task } from"@trigger.dev/sdk/v3";
64
+
65
+
exportconst bunTask =task({
66
+
id: "bun-task",
67
+
run: async (payload: { query:string }) => {
68
+
const db =newDatabase(":memory:");
69
+
const query =db.query("select 'Hello world' as message;");
The CLI `dev` command runs a server for your tasks. It watches for changes in your `/trigger` directory and communicates with the Trigger.dev platform to register your tasks, perform runs, and send data back and forth.
85
+
86
+
It can also update your `@trigger.dev/*` packages to prevent version mismatches and failed deploys. You will always be prompted first.
87
+
88
+
<CodeGroup>
89
+
90
+
```bash npm
91
+
npx trigger.dev@latest dev
92
+
```
93
+
94
+
```bash pnpm
95
+
pnpm dlx trigger.dev@latest dev
96
+
```
97
+
98
+
```bash yarn
99
+
yarn dlx trigger.dev@latest dev
100
+
```
101
+
102
+
</CodeGroup>
103
+
104
+
</Step>
105
+
106
+
<CliRunTestStep />
107
+
<CliViewRunStep />
108
+
109
+
</Steps>
110
+
111
+
## Known issues
112
+
113
+
- Certain OpenTelemetry instrumentation will not work with Bun, because Bun does not support Node's `register` hook. This means that some libraries that rely on this hook will not work with Bun.
0 commit comments