@trigger.dev/sdk 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "4.7.0";
4
+ exports.VERSION = "4.7.1";
5
5
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export const VERSION = "4.7.0";
1
+ export const VERSION = "4.7.1";
2
2
  //# sourceMappingURL=version.js.map
@@ -269,6 +269,8 @@ export default defineConfig({
269
269
 
270
270
  ## Runtime
271
271
 
272
+ If you don't set a `runtime`, your tasks run on the current Node.js LTS. Setting `runtime: "node"` does the same thing — see the Node.js versions section below to pin a specific version instead.
273
+
272
274
  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:
273
275
 
274
276
  ```ts trigger.config.ts
@@ -123,12 +123,12 @@ jobs:
123
123
  - name: Deploy preview branch
124
124
  run: npx trigger.dev@latest deploy --env preview
125
125
  env:
126
- TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
126
+ TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_PREVIEW_ACCESS_TOKEN }}
127
127
  ```
128
128
 
129
129
  For this workflow to work, you need to set the following secrets in your GitHub repository:
130
130
 
131
- - `TRIGGER_ACCESS_TOKEN`: A Trigger.dev personal access token (they start with `tr_pat_`). [Learn how to create one and set it in GitHub](/github-actions#creating-a-personal-access-token).
131
+ - `TRIGGER_PREVIEW_ACCESS_TOKEN`: A Trigger.dev API key for the Preview environment with **Deploy only** access. [Create a deployment API key and add it to GitHub](/github-actions#create-a-deployment-api-key).
132
132
 
133
133
  Notice that the deploy command has `--env preview` at the end. We automatically detect the preview branch from the GitHub actions env var.
134
134
 
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  title: "CI / GitHub Actions"
3
- description: "You can easily deploy your tasks with GitHub actions and other CI environments."
3
+ description: "Deploy your tasks from GitHub Actions and other CI environments using an environment API key."
4
4
  ---
5
5
 
6
- The instructions below are specific to GitHub Actions, but the same concepts can be used with other CI systems.
6
+ The instructions below are specific to GitHub Actions, but the same concepts apply to other CI systems. Use an environment API key rather than a Personal Access Token so deployments are not tied to an individual team member's account or permissions.
7
7
 
8
8
  <Tip>
9
9
  Check out our new [GitHub integration](/github-integration) for automatic deployments, without adding any GitHub Actions workflows.
@@ -74,7 +74,7 @@ jobs:
74
74
 
75
75
  - name: 🚀 Deploy Trigger.dev
76
76
  env:
77
- TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
77
+ TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_STAGING_ACCESS_TOKEN }}
78
78
  run: |
79
79
  npx trigger.dev@latest deploy --env staging --external-id ${{ github.sha }}
80
80
  ```
@@ -135,7 +135,7 @@ jobs:
135
135
  - name: Deploy preview branch
136
136
  run: npx trigger.dev@latest deploy --env preview --external-id ${{ github.event.pull_request.head.sha }}
137
137
  env:
138
- TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
138
+ TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_PREVIEW_ACCESS_TOKEN }}
139
139
  ```
140
140
 
141
141
  On `pull_request`, `github.sha` is the merge commit GitHub creates for the PR, not the commit your
@@ -146,26 +146,36 @@ deployment sends.
146
146
  **Include `closed`** in the `pull_request.types` list. Without it, preview branches won't be archived when PRs are merged or closed, and you may hit the limit on active preview branches. See [Preview branches](/deployment/preview-branches#preview-branches-with-github-actions-recommended) for more details.
147
147
  </Note>
148
148
 
149
- ## Creating a Personal Access Token
149
+ ## Create a deployment API key
150
+
151
+ Create a separate API key for each environment that your CI workflows deploy to. The key remains valid when team membership or permissions change.
150
152
 
151
153
  <Steps>
152
154
 
153
- <Step title="Create a new access token">
154
- Go to your profile page and click on the ["Personal Access
155
- Tokens"](https://cloud.trigger.dev/account/tokens) tab.
155
+ <Step title="Open the API keys page">
156
+ Select the project and target environment, then open [**API keys**](https://cloud.trigger.dev/_/apikeys).
156
157
  </Step>
157
158
 
158
- <Step title="Go to your repository on GitHub.">
159
- Click on 'Settings' -> 'Secrets and variables' -> 'Actions' -> 'New repository secret'
159
+ <Step title="Create an API key">
160
+ Click **New API key**, give the key a name that identifies the workflow, and choose **Deploy
161
+ only** access.
160
162
  </Step>
161
163
 
162
- <Step title="Add the TRIGGER_ACCESS_TOKEN">
163
- Add the name `TRIGGER_ACCESS_TOKEN` and the value of your access token. ![Add TRIGGER_ACCESS_TOKEN
164
- in GitHub](/images/github-access-token.png)
164
+ <Step title="Copy the API key">
165
+ Create the key and copy its value. Trigger.dev shows the complete value only once.
166
+ </Step>
167
+
168
+ <Step title="Add the TRIGGER_ACCESS_TOKEN secret to GitHub">
169
+ Open the repository's **Settings**, then select **Secrets and variables** → **Actions** → **New
170
+ repository secret**. Add the name `TRIGGER_ACCESS_TOKEN` and paste the API key as its value.
171
+
172
+ ![Add TRIGGER_ACCESS_TOKEN in GitHub](/images/github-access-token.png)
165
173
  </Step>
166
174
 
167
175
  </Steps>
168
176
 
177
+ The API key must belong to the environment targeted by the deploy command. If the repository deploys to multiple environments, store each environment's key in a separate GitHub secret and map the appropriate secret to `TRIGGER_ACCESS_TOKEN` in each workflow.
178
+
169
179
  ## CLI Version pinning
170
180
 
171
181
  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.
@@ -178,7 +188,7 @@ Tip: add the `trigger.dev` CLI to your `devDependencies` and the deploy command
178
188
  "deploy:trigger": "trigger deploy --env staging"
179
189
  },
180
190
  "devDependencies": {
181
- "trigger.dev": "4.0.2"
191
+ "trigger.dev": "4.7.0"
182
192
  }
183
193
  }
184
194
  ```
@@ -168,7 +168,7 @@ export default defineConfig({
168
168
 
169
169
  ### Using the Bun runtime
170
170
 
171
- By default, Trigger.dev will use the Node.js runtime. If you're using Bun, you can specify the runtime:
171
+ By default, Trigger.dev runs your tasks on the current Node.js LTS. If you're using Bun, you can specify the runtime:
172
172
 
173
173
  ```typescript
174
174
  import { defineConfig } from "@trigger.dev/sdk";
@@ -156,6 +156,8 @@ mode: "wide"
156
156
  | `EVENT_REPOSITORY_DEFAULT_STORE` | No | postgres | Where to store task events. Set to `clickhouse_v2` to store in ClickHouse (recommended for production). |
157
157
  | `EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED` | No | 0 | Skip all PostgreSQL task-event writes (set to `1`). Only enable when `EVENT_REPOSITORY_DEFAULT_STORE` is `clickhouse_v2`, otherwise task events are lost. |
158
158
  | **Realtime** | | | |
159
+ | `REALTIME_BACKEND_NATIVE_ENABLED` | No | 0 | Set to `1` to enable native realtime run subscriptions and change notifications. When `0`, subscriptions use Electric. The Helm chart sets this to `1`. |
160
+ | `REALTIME_BACKEND_DEFAULT` | No | electric | Backend for run subscriptions when native realtime is enabled and no `realtimeBackend` feature-flag override is set. One of `electric`, `native`, `shadow`. The Helm chart sets this to `native`. Separate from realtime stream version settings. |
159
161
  | `REALTIME_STREAM_VERSION` | No | v1 | Stream version exposed to tasks via the `TRIGGER_REALTIME_STREAM_VERSION` variable. Distinct from `REALTIME_STREAMS_DEFAULT_VERSION`. One of `v1`, `v2`. |
160
162
  | `REALTIME_STREAM_MAX_LENGTH` | No | 1000 | Realtime stream max length. |
161
163
  | `REALTIME_STREAM_TTL` | No | 86400 (1d) | Realtime stream TTL (s). |
@@ -35,7 +35,13 @@ flowchart TD
35
35
  workers --> reg
36
36
  ```
37
37
 
38
- Each component maps to a top-level key in `values.yaml`: `webapp`, `supervisor`, `postgres`, `redis`, `electric`, `clickhouse`, `s3` (object storage), `s2`, and `registry`. The datastores default to `deploy: true` and run in-cluster; set `deploy: false` with an `external` block to bring your own. The registry is the exception - it defaults to `deploy: false`, so you point it at an external one. Webapp settings live under `webapp`, supervisor settings under `supervisor.config`, and each service takes `extraEnvVars` for anything else.
38
+ Each component maps to a top-level key in `values.yaml`: `webapp`, `supervisor`, `postgres`, `redis`, `clickhouse`, `s3` (object storage), `s2`, and `registry`. The datastores default to `deploy: true` and run in-cluster; set `deploy: false` with an `external` block to bring your own. The registry is the exception - it defaults to `deploy: false`, so you point it at an external one. Webapp settings live under `webapp`, supervisor settings under `supervisor.config`, and each service takes `extraEnvVars` for anything else.
39
+
40
+ Realtime run subscriptions use the native backend with the configured PostgreSQL, Redis, and ClickHouse services. The chart sets `REALTIME_BACKEND_NATIVE_ENABLED=1` and `REALTIME_BACKEND_DEFAULT=native`; no Electric service is required. These settings are separate from the S2-backed realtime streams configuration.
41
+
42
+ <Warning>
43
+ Before upgrading from a chart that deploys Electric, unset the global `realtimeBackend` feature flag and any organization overrides, or set them to `native`. Both take precedence over the environment default. Values of `electric` or `shadow` still select the Electric backend, which this chart no longer deploys.
44
+ </Warning>
39
45
 
40
46
  ## Requirements
41
47
 
@@ -91,7 +97,7 @@ Bundled datastores let you run the whole stack with a single command and no exte
91
97
  --create-namespace
92
98
  ```
93
99
 
94
- The chart deploys the webapp, supervisor, and bundled Postgres, Redis, Electric, ClickHouse, MinIO, and s2-lite. The registry is not deployed by default - configure an external one before deploying tasks.
100
+ The chart deploys the webapp, supervisor, and bundled Postgres, Redis, ClickHouse, MinIO, and s2-lite. The registry is not deployed by default - configure an external one before deploying tasks.
95
101
  </Step>
96
102
 
97
103
  <Step title="Port-forward the webapp">
@@ -533,9 +539,14 @@ With external datastores, secrets, registry, and authentication in place, you ha
533
539
 
534
540
  ### Upgrading
535
541
 
536
- `helm upgrade` is safe to run as-is. Your generated secrets, data volumes, and the bundled ClickHouse are preserved and migrated automatically, so a normal upgrade needs no preparation. A few situations need one manual step first — expand any that apply to you.
542
+ Your generated secrets, data volumes, and the bundled ClickHouse are preserved and migrated automatically. Before running `helm upgrade`, complete any prerequisites below that apply to your installation.
537
543
 
538
544
  <AccordionGroup>
545
+ <Accordion title="You upgrade from a chart that deploys Electric">
546
+ Unset the global `realtimeBackend` feature flag and any organization overrides, or set them to `native`, before upgrading. Organization overrides take precedence over the global flag, and the global flag takes precedence over `REALTIME_BACKEND_DEFAULT`.
547
+
548
+ The chart enables native realtime and removes the Electric service. A remaining `electric` or `shadow` flag value directs run subscriptions to that removed service and breaks realtime updates.
549
+ </Accordion>
539
550
  <Accordion title="You supply your own secret (secrets.existingSecret)">
540
551
  With `secrets.existingSecret` set, the chart reads every key from your Secret and generates none, so any key the app needs must already be present there.
541
552
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trigger.dev/sdk",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "description": "trigger.dev Node.JS SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -69,7 +69,7 @@
69
69
  "dependencies": {
70
70
  "@opentelemetry/api": "1.9.1",
71
71
  "@opentelemetry/semantic-conventions": "1.41.1",
72
- "@trigger.dev/core": "4.7.0",
72
+ "@trigger.dev/core": "4.7.1",
73
73
  "uncrypto": "^0.1.3"
74
74
  },
75
75
  "devDependencies": {