@trigger.dev/sdk 4.5.0-rc.6 → 4.5.0-rc.7

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.
Files changed (191) hide show
  1. package/dist/commonjs/v3/ai.d.ts +171 -5
  2. package/dist/commonjs/v3/ai.js +309 -22
  3. package/dist/commonjs/v3/ai.js.map +1 -1
  4. package/dist/commonjs/v3/chat-server.d.ts +8 -0
  5. package/dist/commonjs/v3/chat-server.js +32 -10
  6. package/dist/commonjs/v3/chat-server.js.map +1 -1
  7. package/dist/commonjs/v3/chat-server.test.js +51 -0
  8. package/dist/commonjs/v3/chat-server.test.js.map +1 -1
  9. package/dist/commonjs/v3/createStartSessionAction.test.js +30 -0
  10. package/dist/commonjs/v3/createStartSessionAction.test.js.map +1 -1
  11. package/dist/commonjs/v3/sessions.d.ts +3 -2
  12. package/dist/commonjs/v3/sessions.js +3 -2
  13. package/dist/commonjs/v3/sessions.js.map +1 -1
  14. package/dist/commonjs/version.js +1 -1
  15. package/dist/esm/v3/ai.d.ts +171 -5
  16. package/dist/esm/v3/ai.js +309 -22
  17. package/dist/esm/v3/ai.js.map +1 -1
  18. package/dist/esm/v3/chat-server.d.ts +8 -0
  19. package/dist/esm/v3/chat-server.js +32 -10
  20. package/dist/esm/v3/chat-server.js.map +1 -1
  21. package/dist/esm/v3/chat-server.test.js +51 -0
  22. package/dist/esm/v3/chat-server.test.js.map +1 -1
  23. package/dist/esm/v3/createStartSessionAction.test.js +30 -0
  24. package/dist/esm/v3/createStartSessionAction.test.js.map +1 -1
  25. package/dist/esm/v3/sessions.d.ts +3 -2
  26. package/dist/esm/v3/sessions.js +3 -2
  27. package/dist/esm/v3/sessions.js.map +1 -1
  28. package/dist/esm/version.js +1 -1
  29. package/docs/ai/prompts.mdx +430 -0
  30. package/docs/ai-chat/actions.mdx +115 -0
  31. package/docs/ai-chat/anatomy.mdx +71 -0
  32. package/docs/ai-chat/backend.mdx +817 -0
  33. package/docs/ai-chat/background-injection.mdx +221 -0
  34. package/docs/ai-chat/changelog.mdx +850 -0
  35. package/docs/ai-chat/chat-local.mdx +174 -0
  36. package/docs/ai-chat/client-protocol.mdx +1081 -0
  37. package/docs/ai-chat/compaction.mdx +411 -0
  38. package/docs/ai-chat/custom-agents.mdx +364 -0
  39. package/docs/ai-chat/error-handling.mdx +415 -0
  40. package/docs/ai-chat/fast-starts.mdx +672 -0
  41. package/docs/ai-chat/frontend.mdx +580 -0
  42. package/docs/ai-chat/how-it-works.mdx +230 -0
  43. package/docs/ai-chat/lifecycle-hooks.mdx +530 -0
  44. package/docs/ai-chat/mcp.mdx +101 -0
  45. package/docs/ai-chat/overview.mdx +90 -0
  46. package/docs/ai-chat/patterns/branching-conversations.mdx +284 -0
  47. package/docs/ai-chat/patterns/code-sandbox.mdx +126 -0
  48. package/docs/ai-chat/patterns/database-persistence.mdx +414 -0
  49. package/docs/ai-chat/patterns/human-in-the-loop.mdx +275 -0
  50. package/docs/ai-chat/patterns/large-payloads.mdx +169 -0
  51. package/docs/ai-chat/patterns/oom-resilience.mdx +120 -0
  52. package/docs/ai-chat/patterns/persistence-and-replay.mdx +211 -0
  53. package/docs/ai-chat/patterns/recovery-boot.mdx +230 -0
  54. package/docs/ai-chat/patterns/skills.mdx +221 -0
  55. package/docs/ai-chat/patterns/sub-agents.mdx +383 -0
  56. package/docs/ai-chat/patterns/tool-result-auditing.mdx +148 -0
  57. package/docs/ai-chat/patterns/trusted-edge-signals.mdx +337 -0
  58. package/docs/ai-chat/patterns/version-upgrades.mdx +172 -0
  59. package/docs/ai-chat/pending-messages.mdx +343 -0
  60. package/docs/ai-chat/prompt-caching.mdx +206 -0
  61. package/docs/ai-chat/quick-start.mdx +161 -0
  62. package/docs/ai-chat/reference.mdx +909 -0
  63. package/docs/ai-chat/server-chat.mdx +263 -0
  64. package/docs/ai-chat/sessions.mdx +333 -0
  65. package/docs/ai-chat/testing.mdx +682 -0
  66. package/docs/ai-chat/tools.mdx +191 -0
  67. package/docs/ai-chat/types.mdx +242 -0
  68. package/docs/ai-chat/upgrade-guide.mdx +515 -0
  69. package/docs/apikeys.mdx +54 -0
  70. package/docs/building-with-ai.mdx +261 -0
  71. package/docs/bulk-actions.mdx +49 -0
  72. package/docs/changelog.mdx +6 -0
  73. package/docs/cli-deploy-commands.mdx +9 -0
  74. package/docs/cli-dev-commands.mdx +9 -0
  75. package/docs/cli-dev.mdx +8 -0
  76. package/docs/cli-init-commands.mdx +58 -0
  77. package/docs/cli-introduction.mdx +25 -0
  78. package/docs/cli-list-profiles-commands.mdx +42 -0
  79. package/docs/cli-login-commands.mdx +33 -0
  80. package/docs/cli-logout-commands.mdx +33 -0
  81. package/docs/cli-preview-archive.mdx +59 -0
  82. package/docs/cli-promote-commands.mdx +9 -0
  83. package/docs/cli-switch.mdx +43 -0
  84. package/docs/cli-update-commands.mdx +42 -0
  85. package/docs/cli-whoami-commands.mdx +33 -0
  86. package/docs/community.mdx +6 -0
  87. package/docs/config/config-file.mdx +602 -0
  88. package/docs/config/extensions/additionalFiles.mdx +38 -0
  89. package/docs/config/extensions/additionalPackages.mdx +40 -0
  90. package/docs/config/extensions/aptGet.mdx +34 -0
  91. package/docs/config/extensions/audioWaveform.mdx +20 -0
  92. package/docs/config/extensions/custom.mdx +380 -0
  93. package/docs/config/extensions/emitDecoratorMetadata.mdx +29 -0
  94. package/docs/config/extensions/esbuildPlugin.mdx +31 -0
  95. package/docs/config/extensions/ffmpeg.mdx +45 -0
  96. package/docs/config/extensions/lightpanda.mdx +56 -0
  97. package/docs/config/extensions/overview.mdx +67 -0
  98. package/docs/config/extensions/playwright.mdx +195 -0
  99. package/docs/config/extensions/prismaExtension.mdx +1014 -0
  100. package/docs/config/extensions/puppeteer.mdx +30 -0
  101. package/docs/config/extensions/pythonExtension.mdx +182 -0
  102. package/docs/config/extensions/syncEnvVars.mdx +291 -0
  103. package/docs/context.mdx +235 -0
  104. package/docs/database-connections.mdx +213 -0
  105. package/docs/deploy-environment-variables.mdx +435 -0
  106. package/docs/deployment/atomic-deployment.mdx +172 -0
  107. package/docs/deployment/overview.mdx +257 -0
  108. package/docs/deployment/preview-branches.mdx +224 -0
  109. package/docs/errors-retrying.mdx +379 -0
  110. package/docs/github-actions.mdx +222 -0
  111. package/docs/github-integration.mdx +136 -0
  112. package/docs/github-repo.mdx +8 -0
  113. package/docs/help-email.mdx +6 -0
  114. package/docs/help-slack.mdx +11 -0
  115. package/docs/hidden-tasks.mdx +56 -0
  116. package/docs/how-it-works.mdx +454 -0
  117. package/docs/how-to-reduce-your-spend.mdx +217 -0
  118. package/docs/idempotency.mdx +504 -0
  119. package/docs/introduction.mdx +223 -0
  120. package/docs/limits.mdx +241 -0
  121. package/docs/logging.mdx +195 -0
  122. package/docs/machines.mdx +952 -0
  123. package/docs/manual-setup.mdx +632 -0
  124. package/docs/mcp-agent-rules.mdx +41 -0
  125. package/docs/mcp-introduction.mdx +385 -0
  126. package/docs/mcp-tools.mdx +273 -0
  127. package/docs/migrating-from-v3.mdx +334 -0
  128. package/docs/observability/dashboards.mdx +102 -0
  129. package/docs/observability/query.mdx +585 -0
  130. package/docs/open-source-contributing.mdx +16 -0
  131. package/docs/open-source-self-hosting.mdx +541 -0
  132. package/docs/private-networking/aws-console-setup.mdx +304 -0
  133. package/docs/private-networking/overview.mdx +144 -0
  134. package/docs/private-networking/troubleshooting.mdx +78 -0
  135. package/docs/queue-concurrency.mdx +354 -0
  136. package/docs/quick-start.mdx +97 -0
  137. package/docs/realtime/auth.mdx +208 -0
  138. package/docs/realtime/backend/overview.mdx +45 -0
  139. package/docs/realtime/backend/streams.mdx +418 -0
  140. package/docs/realtime/backend/subscribe.mdx +225 -0
  141. package/docs/realtime/how-it-works.mdx +94 -0
  142. package/docs/realtime/overview.mdx +63 -0
  143. package/docs/realtime/react-hooks/overview.mdx +73 -0
  144. package/docs/realtime/react-hooks/streams.mdx +449 -0
  145. package/docs/realtime/react-hooks/subscribe.mdx +674 -0
  146. package/docs/realtime/react-hooks/swr.mdx +87 -0
  147. package/docs/realtime/react-hooks/triggering.mdx +194 -0
  148. package/docs/realtime/react-hooks/use-wait-token.mdx +34 -0
  149. package/docs/realtime/run-object.mdx +174 -0
  150. package/docs/replaying.mdx +72 -0
  151. package/docs/request-feature.mdx +6 -0
  152. package/docs/roadmap.mdx +6 -0
  153. package/docs/run-tests.mdx +20 -0
  154. package/docs/run-usage.mdx +113 -0
  155. package/docs/runs/heartbeats.mdx +38 -0
  156. package/docs/runs/max-duration.mdx +139 -0
  157. package/docs/runs/metadata.mdx +734 -0
  158. package/docs/runs/priority.mdx +31 -0
  159. package/docs/runs.mdx +396 -0
  160. package/docs/self-hosting/docker.mdx +458 -0
  161. package/docs/self-hosting/env/supervisor.mdx +74 -0
  162. package/docs/self-hosting/env/webapp.mdx +276 -0
  163. package/docs/self-hosting/kubernetes.mdx +601 -0
  164. package/docs/self-hosting/overview.mdx +108 -0
  165. package/docs/skills.mdx +85 -0
  166. package/docs/tags.mdx +120 -0
  167. package/docs/tasks/overview.mdx +697 -0
  168. package/docs/tasks/scheduled.mdx +382 -0
  169. package/docs/tasks/schemaTask.mdx +413 -0
  170. package/docs/tasks/streams.mdx +884 -0
  171. package/docs/triggering.mdx +1320 -0
  172. package/docs/troubleshooting-alerts.mdx +385 -0
  173. package/docs/troubleshooting-debugging-in-vscode.mdx +8 -0
  174. package/docs/troubleshooting-github-issues.mdx +6 -0
  175. package/docs/troubleshooting-uptime-status.mdx +6 -0
  176. package/docs/troubleshooting.mdx +398 -0
  177. package/docs/upgrading-packages.mdx +80 -0
  178. package/docs/vercel-integration.mdx +207 -0
  179. package/docs/versioning.mdx +56 -0
  180. package/docs/video-walkthrough.mdx +23 -0
  181. package/docs/wait-for-token.mdx +540 -0
  182. package/docs/wait-for.mdx +42 -0
  183. package/docs/wait-until.mdx +53 -0
  184. package/docs/wait.mdx +18 -0
  185. package/docs/writing-tasks-introduction.mdx +33 -0
  186. package/package.json +8 -5
  187. package/skills/trigger-authoring-chat-agent/SKILL.md +296 -0
  188. package/skills/trigger-authoring-tasks/SKILL.md +254 -0
  189. package/skills/trigger-chat-agent-advanced/SKILL.md +368 -0
  190. package/skills/trigger-cost-savings/SKILL.md +116 -0
  191. package/skills/trigger-realtime-and-frontend/SKILL.md +276 -0
@@ -0,0 +1,1014 @@
1
+ ---
2
+ title: "Prisma"
3
+ sidebarTitle: "prismaExtension"
4
+ description: "Use the prismaExtension build extension to use Prisma with Trigger.dev"
5
+ ---
6
+
7
+ The `prismaExtension` supports multiple Prisma versions and deployment strategies through **three distinct modes** that handle the evolving Prisma ecosystem, from legacy setups to Prisma 7.
8
+
9
+ <Note>
10
+ The `prismaExtension` requires an explicit `mode` parameter. All configurations must specify a
11
+ mode.
12
+ </Note>
13
+
14
+ ## Migration from previous versions
15
+
16
+ ### Before (pre 4.1.1)
17
+
18
+ ```ts
19
+ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
20
+
21
+ extensions: [
22
+ prismaExtension({
23
+ schema: "prisma/schema.prisma",
24
+ migrate: true,
25
+ typedSql: true,
26
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED",
27
+ }),
28
+ ];
29
+ ```
30
+
31
+ ### After (4.1.1+)
32
+
33
+ ```ts
34
+ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
35
+
36
+ extensions: [
37
+ prismaExtension({
38
+ mode: "legacy", // MODE IS REQUIRED
39
+ schema: "prisma/schema.prisma",
40
+ migrate: true,
41
+ typedSql: true,
42
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED",
43
+ }),
44
+ ];
45
+ ```
46
+
47
+ ## Choosing the right mode
48
+
49
+ Use this decision tree to determine which mode is right for your project:
50
+
51
+ ```mermaid
52
+ flowchart TD
53
+ Start([Which mode should I use?]) --> Q1{Using Prisma 7 or<br/>6.20+ beta?}
54
+ Q1 -->|Yes| Modern[Modern Mode]
55
+ Q1 -->|No| Q2{Using Prisma 6.16+<br/>with engineType='client'?}
56
+ Q2 -->|Yes| Modern
57
+ Q2 -->|No| Q3{Need custom client<br/>output path?}
58
+ Q3 -->|Yes| Q4{Want to manage<br/>prisma generate yourself?}
59
+ Q4 -->|Yes| Engine[Engine-only Mode]
60
+ Q4 -->|No| Legacy[Legacy Mode]
61
+ Q3 -->|No| Legacy
62
+
63
+ Modern -->|Features| ModernFeatures["• Zero configuration<br/>• Database adapters<br/>• Plain TypeScript (no binaries)<br/>• You manage generation"]
64
+ Engine -->|Features| EngineFeatures["• Only installs engines<br/>• Auto version detection<br/>• You manage generation<br/>• Minimal overhead"]
65
+ Legacy -->|Features| LegacyFeatures["• Auto prisma generate<br/>• Migrations support<br/>• TypedSQL support<br/>• Config file support"]
66
+
67
+ style Modern fill:#10b981,stroke:#059669,color:#fff
68
+ style Engine fill:#3b82f6,stroke:#2563eb,color:#fff
69
+ style Legacy fill:#8b5cf6,stroke:#7c3aed,color:#fff
70
+ ```
71
+
72
+ ## Extension modes
73
+
74
+ ### Legacy mode
75
+
76
+ **Use when:** You're using Prisma 6.x or earlier with the `prisma-client-js` provider.
77
+
78
+ **Features:**
79
+
80
+ - Automatic `prisma generate` during deployment
81
+ - Supports single-file schemas (`prisma/schema.prisma`)
82
+ - Supports multi-file schemas (Prisma 6.7+, directory-based schemas)
83
+ - Supports Prisma config files (`prisma.config.ts`) via `@prisma/config` package
84
+ - Migration support with `migrate: true`
85
+ - TypedSQL support with `typedSql: true`
86
+ - Custom generator selection
87
+ - Handles Prisma client versioning automatically (with filesystem fallback detection)
88
+ - Automatic extraction of schema and migrations paths from config files
89
+
90
+ **Schema configuration:**
91
+
92
+ ```prisma
93
+ generator client {
94
+ provider = "prisma-client-js"
95
+ previewFeatures = ["typedSql"]
96
+ }
97
+
98
+ datasource db {
99
+ provider = "postgresql"
100
+ url = env("DATABASE_URL")
101
+ directUrl = env("DATABASE_URL_UNPOOLED")
102
+ }
103
+ ```
104
+
105
+ **Extension configuration:**
106
+
107
+ ```ts
108
+ // Single-file schema
109
+ prismaExtension({
110
+ mode: "legacy",
111
+ schema: "prisma/schema.prisma",
112
+ migrate: true,
113
+ typedSql: true,
114
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED",
115
+ });
116
+
117
+ // Multi-file schema (Prisma 6.7+)
118
+ prismaExtension({
119
+ mode: "legacy",
120
+ schema: "./prisma", // Point to directory
121
+ migrate: true,
122
+ typedSql: true,
123
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED",
124
+ });
125
+ ```
126
+
127
+ **Tested versions:**
128
+
129
+ - Prisma 6.14.0
130
+ - Prisma 6.7.0+ (multi-file schema support)
131
+ - Prisma 5.x
132
+
133
+ ---
134
+
135
+ ### Engine-only mode
136
+
137
+ **Use when:** You have a custom Prisma client output path and want to manage `prisma generate` yourself.
138
+
139
+ **Features:**
140
+
141
+ - Only installs Prisma engine binaries (no client generation)
142
+ - Automatic version detection from `@prisma/client`
143
+ - Manual override of version and binary target
144
+ - Minimal overhead - just ensures engines are available
145
+ - You control when and how `prisma generate` runs
146
+
147
+ **Schema configuration:**
148
+
149
+ ```prisma
150
+ generator client {
151
+ provider = "prisma-client-js"
152
+ output = "../src/generated/prisma"
153
+ // Ensure the "debian-openssl-3.0.x" binary target is included for deployment to the trigger.dev cloud
154
+ binaryTargets = ["native", "debian-openssl-3.0.x"]
155
+ }
156
+
157
+ datasource db {
158
+ provider = "postgresql"
159
+ url = env("DATABASE_URL")
160
+ directUrl = env("DATABASE_URL_UNPOOLED")
161
+ }
162
+ ```
163
+
164
+ **Extension configuration:**
165
+
166
+ ```ts
167
+ // Auto-detect version
168
+ prismaExtension({
169
+ mode: "engine-only",
170
+ });
171
+
172
+ // Explicit version (recommended for reproducible builds)
173
+ prismaExtension({
174
+ mode: "engine-only",
175
+ version: "6.19.0",
176
+ });
177
+ ```
178
+
179
+ **Important notes:**
180
+
181
+ - You **must** run `prisma generate` yourself (typically in a prebuild script)
182
+ - Your schema **must** include the correct `binaryTargets` for deployment to the trigger.dev cloud. The binary target is `debian-openssl-3.0.x`.
183
+ - The extension sets `PRISMA_QUERY_ENGINE_LIBRARY` and `PRISMA_QUERY_ENGINE_SCHEMA_ENGINE` environment variables to the correct paths for the binary targets.
184
+
185
+ **package.json example:**
186
+
187
+ ```json
188
+ {
189
+ "scripts": {
190
+ "prebuild": "prisma generate",
191
+ "dev": "trigger dev",
192
+ "deploy": "trigger deploy"
193
+ }
194
+ }
195
+ ```
196
+
197
+ **Tested versions:**
198
+
199
+ - Prisma 6.19.0
200
+ - Prisma 6.16.0+
201
+
202
+ ---
203
+
204
+ ### Modern mode
205
+
206
+ **Use when:** You're using Prisma 6.16+ with the new `prisma-client` provider (with `engineType = "client"`) or preparing for Prisma 7.
207
+
208
+ **Features:**
209
+
210
+ - Designed for the new Prisma architecture
211
+ - Zero configuration required
212
+ - Automatically marks `@prisma/client` as external
213
+ - Works with Prisma 7 beta releases & Prisma 7 when released
214
+ - You manage client generation (like engine-only mode)
215
+
216
+ **Schema configuration (Prisma 6.16+ with engineType):**
217
+
218
+ ```prisma
219
+ generator client {
220
+ provider = "prisma-client"
221
+ output = "../src/generated/prisma"
222
+ engineType = "client"
223
+ previewFeatures = ["views"]
224
+ }
225
+
226
+ datasource db {
227
+ provider = "postgresql"
228
+ url = env("DATABASE_URL")
229
+ directUrl = env("DATABASE_URL_UNPOOLED")
230
+ }
231
+ ```
232
+
233
+ **Schema configuration (Prisma 7):**
234
+
235
+ ```prisma
236
+ generator client {
237
+ provider = "prisma-client"
238
+ output = "../src/generated/prisma"
239
+ }
240
+
241
+ datasource db {
242
+ provider = "postgresql"
243
+ }
244
+ ```
245
+
246
+ **Extension configuration:**
247
+
248
+ ```ts
249
+ prismaExtension({
250
+ mode: "modern",
251
+ });
252
+ ```
253
+
254
+ **Prisma config (Prisma 7):**
255
+
256
+ ```ts
257
+ // prisma.config.ts
258
+ import { defineConfig, env } from "prisma/config";
259
+ import "dotenv/config";
260
+
261
+ export default defineConfig({
262
+ schema: "prisma/schema.prisma",
263
+ migrations: {
264
+ path: "prisma/migrations",
265
+ },
266
+ datasource: {
267
+ url: env("DATABASE_URL"),
268
+ },
269
+ });
270
+ ```
271
+
272
+ **Important notes:**
273
+
274
+ - You **must** run `prisma generate` yourself.
275
+ - Requires Prisma 6.16.0+ or Prisma 7 beta
276
+ - The new `prisma-client` provider generates plain TypeScript (no Rust binaries)
277
+ - Requires database adapters (e.g., `@prisma/adapter-pg` for PostgreSQL)
278
+
279
+ **Tested versions:**
280
+
281
+ - Prisma 6.16.0 with `engineType = "client"`
282
+ - Prisma 6.20.0-integration-next.8 (Prisma 7 beta)
283
+
284
+ ---
285
+
286
+ ## Migration guide
287
+
288
+ ### From old prismaExtension to legacy mode
289
+
290
+ If you were using the previous `prismaExtension`, migrate to legacy mode:
291
+
292
+ ```ts
293
+ // Old
294
+ prismaExtension({
295
+ schema: "prisma/schema.prisma",
296
+ migrate: true,
297
+ });
298
+
299
+ // New - add mode
300
+ prismaExtension({
301
+ mode: "legacy",
302
+ schema: "prisma/schema.prisma",
303
+ migrate: true,
304
+ });
305
+ ```
306
+
307
+ ### Preparing for Prisma 7
308
+
309
+ If you want to adopt the new Prisma architecture, use modern mode:
310
+
311
+ 1. Update your schema to use `prisma-client` provider
312
+ 2. Add database adapters to your dependencies
313
+ 3. Configure the extension:
314
+
315
+ ```ts
316
+ prismaExtension({
317
+ mode: "modern",
318
+ });
319
+ ```
320
+
321
+ ### Manage your own prisma generate step
322
+
323
+ When using `modern` and `engine-only` modes, you'll need to ensure that you run `prisma generate` yourself before deploying your project.
324
+
325
+ #### Github Actions
326
+
327
+ If you are deploying your project using GitHub Actions, you can add a step to your workflow to run `prisma generate` before deploying your project, for example:
328
+
329
+ ```yaml
330
+ steps:
331
+ - name: Generate Prisma client
332
+ run: npx prisma@6.19.0 generate
333
+ - name: Deploy Trigger.dev
334
+ run: npx trigger.dev@4.1.1 deploy
335
+ env:
336
+ TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
337
+ ```
338
+
339
+ #### Trigger.dev Github integration
340
+
341
+ If you are using the [Trigger.dev Github integration](/github-integration), you can configure a pre-build command to run `prisma generate` before deploying your project. Navigate to your project's settings page and configure the pre-build command to run `prisma generate`, for example:
342
+
343
+ ![Pre-build command](/images/pre-build-command-prisma-generate.png)
344
+
345
+ ---
346
+
347
+ ## Version compatibility matrix
348
+
349
+ | Prisma version | Recommended mode | Notes |
350
+ | ---------------- | --------------------- | -------------------------------------------- |
351
+ | < 5.0 | Legacy | Older Prisma versions |
352
+ | 5.0 - 6.15 | Legacy | Standard Prisma setup |
353
+ | 6.7+ | Legacy | Multi-file schema support |
354
+ | 6.16+ | Engine-only or Modern | Modern mode requires `engineType = "client"` |
355
+ | 6.20+ (7.0 beta) | Modern | Prisma 7 with new architecture |
356
+
357
+ ---
358
+
359
+ ## Prisma config file support
360
+
361
+ Legacy mode supports loading configuration from a `prisma.config.ts` file using the official `@prisma/config` package.
362
+
363
+ **Use when:** You want to use Prisma's new config file format (Prisma 6+) to centralize your Prisma configuration.
364
+
365
+ **Benefits:**
366
+
367
+ - Single source of truth for Prisma configuration
368
+ - Automatic extraction of schema location and migrations path
369
+ - Type-safe configuration with TypeScript
370
+ - Works seamlessly with Prisma 7's config-first approach
371
+
372
+ **prisma.config.ts:**
373
+
374
+ ```ts
375
+ import { defineConfig, env } from "prisma/config";
376
+ import "dotenv/config";
377
+
378
+ export default defineConfig({
379
+ schema: "prisma/schema.prisma",
380
+ migrations: {
381
+ path: "prisma/migrations",
382
+ },
383
+ datasource: {
384
+ url: env("DATABASE_URL"),
385
+ directUrl: env("DATABASE_URL_UNPOOLED"),
386
+ },
387
+ });
388
+ ```
389
+
390
+ **trigger.config.ts:**
391
+
392
+ ```ts
393
+ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
394
+
395
+ prismaExtension({
396
+ mode: "legacy",
397
+ configFile: "./prisma.config.ts", // Use config file instead of schema
398
+ migrate: true,
399
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED", // For migrations
400
+ });
401
+ ```
402
+
403
+ **What gets extracted:**
404
+
405
+ - `schema` - The schema file or directory path
406
+ - `migrations.path` - The migrations directory path (if specified)
407
+
408
+ **Note:** Either `schema` or `configFile` must be specified, but not both.
409
+
410
+ **When to use which:**
411
+
412
+ | Use `schema` option | Use `configFile` option |
413
+ | ---------------------------- | --------------------------------- |
414
+ | Standard Prisma setup | Using Prisma 6+ with config files |
415
+ | Single or multi-file schemas | Preparing for Prisma 7 |
416
+ | No `prisma.config.ts` file | Centralized configuration needed |
417
+ | Simple setup | Want migrations path in config |
418
+
419
+ ---
420
+
421
+ ## Multi-file schema support
422
+
423
+ Prisma 6.7 introduced support for splitting your schema across multiple files in a directory structure.
424
+
425
+ **Example structure:**
426
+
427
+ ```
428
+ prisma/
429
+ ├── schema.prisma (main file with generator/datasource)
430
+ ├── models/
431
+ │ ├── users.prisma
432
+ │ └── posts.prisma
433
+ └── sql/
434
+ └── getUserByEmail.sql
435
+ ```
436
+
437
+ **Configuration:**
438
+
439
+ ```ts
440
+ prismaExtension({
441
+ mode: "legacy",
442
+ schema: "./prisma", // Point to directory instead of file
443
+ migrate: true,
444
+ typedSql: true,
445
+ });
446
+ ```
447
+
448
+ **package.json:**
449
+
450
+ ```json
451
+ {
452
+ "prisma": {
453
+ "schema": "./prisma"
454
+ }
455
+ }
456
+ ```
457
+
458
+ ---
459
+
460
+ ## TypedSQL support
461
+
462
+ TypedSQL is available in legacy mode for Prisma 5.19.0+ with the `typedSql` preview feature.
463
+
464
+ **Schema configuration:**
465
+
466
+ ```prisma
467
+ generator client {
468
+ provider = "prisma-client-js"
469
+ previewFeatures = ["typedSql"]
470
+ }
471
+ ```
472
+
473
+ **Extension configuration:**
474
+
475
+ ```ts
476
+ prismaExtension({
477
+ mode: "legacy",
478
+ schema: "prisma/schema.prisma",
479
+ typedSql: true, // Enable TypedSQL
480
+ });
481
+ ```
482
+
483
+ **Usage in tasks:**
484
+
485
+ ```ts
486
+ import { db, sql } from "./db";
487
+
488
+ const users = await db.$queryRawTyped(sql.getUserByEmail("user@example.com"));
489
+ ```
490
+
491
+ ---
492
+
493
+ ## Database migration support
494
+
495
+ Migrations are supported in legacy mode only.
496
+
497
+ **Extension configuration:**
498
+
499
+ ```ts
500
+ // Using schema option
501
+ prismaExtension({
502
+ mode: "legacy",
503
+ schema: "prisma/schema.prisma",
504
+ migrate: true, // Run migrations on deployment
505
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED", // For connection pooling
506
+ });
507
+
508
+ // Using configFile option
509
+ prismaExtension({
510
+ mode: "legacy",
511
+ configFile: "./prisma.config.ts", // Migrations path extracted from config
512
+ migrate: true,
513
+ });
514
+ ```
515
+
516
+ **What this does:**
517
+
518
+ 1. Copies `prisma/migrations/` to the build output
519
+ 2. Runs `prisma migrate deploy` before generating the client
520
+ 3. Uses the `directUrlEnvVarName` for unpooled connections (required for migrations)
521
+
522
+ When using `configFile`, the migrations path is automatically extracted from your `prisma.config.ts`:
523
+
524
+ ```ts
525
+ // prisma.config.ts
526
+ export default defineConfig({
527
+ schema: "prisma/schema.prisma",
528
+ migrations: {
529
+ path: "prisma/migrations", // Automatically used by the extension
530
+ },
531
+ });
532
+ ```
533
+
534
+ ---
535
+
536
+ ## Binary targets and deployment
537
+
538
+ ### Trigger.dev Cloud
539
+
540
+ The default binary target is `debian-openssl-3.0.x` for Trigger.dev Cloud deployments.
541
+
542
+ **Legacy mode:** Handled automatically
543
+
544
+ **Engine-only mode:** Specify in schema like so:
545
+
546
+ ```prisma
547
+ generator client {
548
+ provider = "prisma-client-js"
549
+ binaryTargets = ["native", "debian-openssl-3.0.x"]
550
+ }
551
+ ```
552
+
553
+ **Modern mode:** Handled by database adapters
554
+
555
+ ### Self-hosted / local deployment
556
+
557
+ For local deployments (e.g., Docker on macOS), you may need a different binary target like so:
558
+
559
+ ```ts
560
+ prismaExtension({
561
+ mode: "engine-only",
562
+ version: "6.19.0",
563
+ binaryTarget: "linux-arm64-openssl-3.0.x", // For macOS ARM64
564
+ });
565
+ ```
566
+
567
+ ---
568
+
569
+ ## Environment variables
570
+
571
+ ### Required variables
572
+
573
+ All modes:
574
+
575
+ - `DATABASE_URL`: Your database connection string
576
+
577
+ Legacy mode with migrations:
578
+
579
+ - `DATABASE_URL_UNPOOLED` (or your custom `directUrlEnvVarName`): Direct database connection for migrations
580
+
581
+ ### Auto-set variables
582
+
583
+ Engine-only mode sets:
584
+
585
+ - `PRISMA_QUERY_ENGINE_LIBRARY`: Path to the query engine
586
+ - `PRISMA_QUERY_ENGINE_SCHEMA_ENGINE`: Path to the schema engine
587
+
588
+ ---
589
+
590
+ ## Troubleshooting
591
+
592
+ ### "Could not find Prisma schema"
593
+
594
+ **Legacy mode:** Ensure the `schema` path is correct relative to your working directory.
595
+
596
+ ```ts
597
+ // If your project structure is:
598
+ // project/
599
+ // trigger.config.ts
600
+ // prisma/
601
+ // schema.prisma
602
+
603
+ prismaExtension({
604
+ mode: "legacy",
605
+ schema: "./prisma/schema.prisma", // Correct
606
+ // schema: "prisma/schema.prisma", // Also works
607
+ });
608
+ ```
609
+
610
+ ### "Could not determine @prisma/client version"
611
+
612
+ The extension includes improved version detection that tries multiple strategies:
613
+
614
+ 1. Check if `@prisma/client` is imported in your code (externals)
615
+ 2. Use the `version` option if specified
616
+ 3. Detect from filesystem by looking for `@prisma/client` or `prisma` in `node_modules`
617
+
618
+ **Legacy mode:** The extension will automatically detect the version from your installed packages. If it still fails, specify the version explicitly:
619
+
620
+ ```ts
621
+ prismaExtension({
622
+ mode: "legacy",
623
+ schema: "prisma/schema.prisma",
624
+ version: "6.19.0", // Add explicit version
625
+ });
626
+ ```
627
+
628
+ **Engine-only mode:** Specify the version explicitly:
629
+
630
+ ```ts
631
+ prismaExtension({
632
+ mode: "engine-only",
633
+ version: "6.19.0", // Add explicit version
634
+ });
635
+ ```
636
+
637
+ ### "Binary target not found"
638
+
639
+ **Engine-only mode:** Make sure your schema includes the deployment binary target:
640
+
641
+ ```prisma
642
+ generator client {
643
+ provider = "prisma-client-js"
644
+ binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
645
+ }
646
+ ```
647
+
648
+ ### "Module not found: @prisma/client/sql"
649
+
650
+ **Legacy mode:** Make sure `typedSql: true` is set and you have Prisma 5.19.0+:
651
+
652
+ ```ts
653
+ prismaExtension({
654
+ mode: "legacy",
655
+ schema: "prisma/schema.prisma",
656
+ typedSql: true, // Required for TypedSQL
657
+ });
658
+ ```
659
+
660
+ ### "Config file not found" or config loading errors
661
+
662
+ **Legacy mode with configFile:** Ensure the config file path is correct:
663
+
664
+ ```ts
665
+ prismaExtension({
666
+ mode: "legacy",
667
+ configFile: "./prisma.config.ts", // Path relative to project root
668
+ migrate: true,
669
+ });
670
+ ```
671
+
672
+ **Requirements:**
673
+
674
+ - The config file must exist at the specified path
675
+ - Your project must have the `prisma` package installed (Prisma 6+)
676
+ - The config file must have a default export
677
+ - The config must specify a `schema` path
678
+
679
+ **Debugging:**
680
+
681
+ Use `--log-level debug` in your `trigger deploy` command to see detailed logs:
682
+
683
+ ```ts
684
+ npx trigger.dev@latest deploy --log-level debug
685
+ ```
686
+
687
+ Then grep for `[PrismaExtension]` in your build logs to see detailed information about config loading, schema resolution, and migrations setup.
688
+
689
+ ---
690
+
691
+ ## Complete examples
692
+
693
+ ### Example 1: Standard Prisma 6 setup (legacy mode)
694
+
695
+ **prisma/schema.prisma:**
696
+
697
+ ```prisma
698
+ generator client {
699
+ provider = "prisma-client-js"
700
+ previewFeatures = ["typedSql"]
701
+ }
702
+
703
+ datasource db {
704
+ provider = "postgresql"
705
+ url = env("DATABASE_URL")
706
+ directUrl = env("DATABASE_URL_UNPOOLED")
707
+ }
708
+ ```
709
+
710
+ **trigger.config.ts:**
711
+
712
+ ```ts
713
+ import { defineConfig } from "@trigger.dev/sdk";
714
+ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
715
+
716
+ export default defineConfig({
717
+ project: process.env.TRIGGER_PROJECT_REF!,
718
+ build: {
719
+ extensions: [
720
+ prismaExtension({
721
+ mode: "legacy",
722
+ schema: "prisma/schema.prisma",
723
+ migrate: true,
724
+ typedSql: true,
725
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED",
726
+ }),
727
+ ],
728
+ },
729
+ });
730
+ ```
731
+
732
+ ---
733
+
734
+ ### Example 2: Multi-file schema (legacy mode)
735
+
736
+ **prisma/schema.prisma:**
737
+
738
+ ```prisma
739
+ generator client {
740
+ provider = "prisma-client-js"
741
+ previewFeatures = ["typedSql"]
742
+ }
743
+
744
+ datasource db {
745
+ provider = "postgresql"
746
+ url = env("DATABASE_URL")
747
+ directUrl = env("DATABASE_URL_UNPOOLED")
748
+ }
749
+ ```
750
+
751
+ **prisma/models/users.prisma:**
752
+
753
+ ```prisma
754
+ model User {
755
+ id String @id @default(cuid())
756
+ email String @unique
757
+ name String?
758
+ posts Post[]
759
+ }
760
+ ```
761
+
762
+ **prisma/models/posts.prisma:**
763
+
764
+ ```prisma
765
+ model Post {
766
+ id String @id @default(cuid())
767
+ title String
768
+ content String
769
+ authorId String
770
+ author User @relation(fields: [authorId], references: [id])
771
+ }
772
+ ```
773
+
774
+ **package.json:**
775
+
776
+ ```json
777
+ {
778
+ "prisma": {
779
+ "schema": "./prisma"
780
+ }
781
+ }
782
+ ```
783
+
784
+ **trigger.config.ts:**
785
+
786
+ ```ts
787
+ prismaExtension({
788
+ mode: "legacy",
789
+ schema: "./prisma", // Directory, not file
790
+ migrate: true,
791
+ typedSql: true,
792
+ directUrlEnvVarName: "DATABASE_URL_UNPOOLED",
793
+ });
794
+ ```
795
+
796
+ ---
797
+
798
+ ### Example 3: Using Prisma config file (legacy mode)
799
+
800
+ Use a `prisma.config.ts` file to centralize your Prisma configuration.
801
+
802
+ **prisma.config.ts:**
803
+
804
+ ```ts
805
+ import { defineConfig, env } from "prisma/config";
806
+ import "dotenv/config";
807
+
808
+ export default defineConfig({
809
+ schema: "prisma/schema.prisma",
810
+ migrations: {
811
+ path: "prisma/migrations",
812
+ },
813
+ datasource: {
814
+ url: env("DATABASE_URL"),
815
+ directUrl: env("DATABASE_URL_UNPOOLED"),
816
+ },
817
+ });
818
+ ```
819
+
820
+ **prisma/schema.prisma:**
821
+
822
+ ```prisma
823
+ generator client {
824
+ provider = "prisma-client-js"
825
+ previewFeatures = ["typedSql"]
826
+ }
827
+
828
+ datasource db {
829
+ provider = "postgresql"
830
+ url = env("DATABASE_URL")
831
+ directUrl = env("DATABASE_URL_UNPOOLED")
832
+ }
833
+
834
+ model User {
835
+ id String @id @default(cuid())
836
+ email String @unique
837
+ name String?
838
+ }
839
+ ```
840
+
841
+ **trigger.config.ts:**
842
+
843
+ ```ts
844
+ import { defineConfig } from "@trigger.dev/sdk";
845
+ import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
846
+
847
+ export default defineConfig({
848
+ project: process.env.TRIGGER_PROJECT_REF!,
849
+ build: {
850
+ extensions: [
851
+ prismaExtension({
852
+ mode: "legacy",
853
+ configFile: "./prisma.config.ts", // Load from config file
854
+ migrate: true,
855
+ typedSql: true,
856
+ // schema and migrations path are extracted from prisma.config.ts
857
+ }),
858
+ ],
859
+ },
860
+ });
861
+ ```
862
+
863
+ **src/db.ts:**
864
+
865
+ ```ts
866
+ import { PrismaClient } from "@prisma/client";
867
+ export * as sql from "@prisma/client/sql";
868
+
869
+ export const db = new PrismaClient({
870
+ datasources: {
871
+ db: {
872
+ url: process.env.DATABASE_URL,
873
+ },
874
+ },
875
+ });
876
+ ```
877
+
878
+ ---
879
+
880
+ ### Example 4: Custom output path (engine-only mode)
881
+
882
+ **prisma/schema.prisma:**
883
+
884
+ ```prisma
885
+ generator client {
886
+ provider = "prisma-client-js"
887
+ output = "../src/generated/prisma"
888
+ binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
889
+ }
890
+
891
+ datasource db {
892
+ provider = "postgresql"
893
+ url = env("DATABASE_URL")
894
+ directUrl = env("DATABASE_URL_UNPOOLED")
895
+ }
896
+ ```
897
+
898
+ **package.json:**
899
+
900
+ ```json
901
+ {
902
+ "scripts": {
903
+ "generate": "prisma generate",
904
+ "dev": "pnpm generate && trigger dev",
905
+ "deploy": "trigger deploy"
906
+ }
907
+ }
908
+ ```
909
+
910
+ **trigger.config.ts:**
911
+
912
+ ```ts
913
+ prismaExtension({
914
+ mode: "engine-only",
915
+ version: "6.19.0",
916
+ binaryTarget: "linux-arm64-openssl-3.0.x",
917
+ });
918
+ ```
919
+
920
+ **src/db.ts:**
921
+
922
+ ```ts
923
+ import { PrismaClient } from "./generated/prisma/client.js";
924
+
925
+ export const db = new PrismaClient({
926
+ datasources: {
927
+ db: {
928
+ url: process.env.DATABASE_URL,
929
+ },
930
+ },
931
+ });
932
+ ```
933
+
934
+ ---
935
+
936
+ ### Example 5: Prisma 7 beta (modern mode)
937
+
938
+ **prisma/schema.prisma:**
939
+
940
+ ```prisma
941
+ generator client {
942
+ provider = "prisma-client"
943
+ output = "../src/generated/prisma"
944
+ }
945
+
946
+ datasource db {
947
+ provider = "postgresql"
948
+ }
949
+ ```
950
+
951
+ **prisma.config.ts:**
952
+
953
+ ```ts
954
+ import { defineConfig, env } from "prisma/config";
955
+ import "dotenv/config";
956
+
957
+ export default defineConfig({
958
+ schema: "prisma/schema.prisma",
959
+ migrations: {
960
+ path: "prisma/migrations",
961
+ },
962
+ datasource: {
963
+ url: env("DATABASE_URL"),
964
+ },
965
+ });
966
+ ```
967
+
968
+ **package.json:**
969
+
970
+ ```json
971
+ {
972
+ "dependencies": {
973
+ "@prisma/client": "6.20.0-integration-next.8",
974
+ "@prisma/adapter-pg": "6.20.0-integration-next.8"
975
+ },
976
+ "scripts": {
977
+ "generate": "prisma generate",
978
+ "dev": "pnpm generate && trigger dev",
979
+ "deploy": "trigger deploy"
980
+ }
981
+ }
982
+ ```
983
+
984
+ **trigger.config.ts:**
985
+
986
+ ```ts
987
+ prismaExtension({
988
+ mode: "modern",
989
+ });
990
+ ```
991
+
992
+ **src/db.ts:**
993
+
994
+ ```ts
995
+ import { PrismaClient } from "./generated/prisma/client.js";
996
+ import { PrismaPg } from "@prisma/adapter-pg";
997
+
998
+ const adapter = new PrismaPg({
999
+ connectionString: process.env.DATABASE_URL!,
1000
+ });
1001
+
1002
+ export const db = new PrismaClient({ adapter });
1003
+ ```
1004
+
1005
+ ---
1006
+
1007
+ ## Resources
1008
+
1009
+ - [Prisma Documentation](https://www.prisma.io/docs)
1010
+ - [Multi-File Schema (Prisma 6.7+)](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema)
1011
+ - [TypedSQL (Prisma 5.19+)](https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/typedsql)
1012
+ - [Prisma 7 Beta Documentation](https://www.prisma.io/docs)
1013
+
1014
+ ---