Skip to content

Commit b68012f

Browse files
authored
v3: Various fixes for Next.js projects and projects that use v2 and v3 together (#1051)
* Fixes an issue that was treating v2 trigger directories as v3 * Make msw a normal dependency (for now) to fix Module Not Found error in Next.js. * Extract out all the zod* stuff from core so the SDK does not import it * Add a changeset * Fixing typecheck errors in the webapp * Export the Task and TaskOptions types * Extract additional exports from core/v3 that aren’t used in the SDK * Move to our global system from AsyncLocalStorage for the current task context storage * Update the esbuild core bundling plugin for the new core v3 exports * Fix v3 CLI telemetry * Add support for tasks located in subdirectories inside trigger dirs * Remove the env var check during deploy (too many false negatives)
1 parent fb83d58 commit b68012f

File tree

76 files changed

+1016
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1016
-801
lines changed

.changeset/eleven-paws-join.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Remove the env var check during deploy (too many false negatives)

.changeset/funny-swans-destroy.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Make msw a normal dependency (for now) to fix Module Not Found error in Next.js.
6+
7+
It turns out that webpack will "hoist" dynamically imported modules and attempt to resolve them at build time, even though it's an optional peer dep:
8+
9+
https://x.com/maverickdotdev/status/1782465214308319404

.changeset/nasty-jars-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Fixes an issue that was treating v2 trigger directories as v3

.changeset/slow-buses-own.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"trigger.dev": patch
4+
"@trigger.dev/core": patch
5+
"@trigger.dev/cli": patch
6+
---
7+
8+
Move to our global system from AsyncLocalStorage for the current task context storage

.changeset/tricky-ladybugs-unite.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/core-apps": patch
4+
"trigger.dev": patch
5+
"@trigger.dev/core": patch
6+
---
7+
8+
Extracting out all the non-SDK related features from the main @trigger.dev/core/v3 export

.changeset/two-pumas-wait.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/cli": patch
4+
---
5+
6+
Add support for tasks located in subdirectories inside trigger dirs

apps/coordinator/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"execa": "^8.0.1",
2222
"nanoid": "^5.0.6",
2323
"prom-client": "^15.1.0",
24-
"socket.io": "^4.7.4",
25-
"socket.io-client": "^4.7.4"
24+
"socket.io": "4.7.4",
25+
"socket.io-client": "4.7.4"
2626
},
2727
"devDependencies": {
2828
"@types/node": "^18",

apps/coordinator/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import {
88
PlatformToCoordinatorMessages,
99
ProdWorkerSocketData,
1010
ProdWorkerToCoordinatorMessages,
11-
ZodNamespace,
12-
ZodSocketConnection,
1311
} from "@trigger.dev/core/v3";
12+
import { ZodNamespace } from "@trigger.dev/core/v3/zodNamespace";
13+
import { ZodSocketConnection } from "@trigger.dev/core/v3/zodSocket";
1414
import { HttpReply, getTextBody, SimpleLogger } from "@trigger.dev/core-apps";
1515

1616
import { collectDefaultMetrics, register, Gauge } from "prom-client";

apps/webapp/app/routes/api.v1.tasks.$taskId.batch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ActionFunctionArgs } from "@remix-run/server-runtime";
22
import { json } from "@remix-run/server-runtime";
3-
import { parseBatchTriggerTaskRequestBody } from "@trigger.dev/core/v3";
3+
import { BatchTriggerTaskRequestBody } from "@trigger.dev/core/v3";
44
import { z } from "zod";
55
import { MAX_BATCH_TRIGGER_ITEMS } from "~/consts";
66
import { authenticateApiRequest } from "~/services/apiAuth.server";
@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
4646
// Now parse the request body
4747
const anyBody = await request.json();
4848

49-
const body = parseBatchTriggerTaskRequestBody(anyBody);
49+
const body = BatchTriggerTaskRequestBody.safeParse(anyBody);
5050

5151
if (!body.success) {
5252
return json({ error: "Invalid request body" }, { status: 400 });

apps/webapp/app/routes/api.v1.tasks.$taskId.trigger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ActionFunctionArgs } from "@remix-run/server-runtime";
22
import { json } from "@remix-run/server-runtime";
3-
import { parseTriggerTaskRequestBody } from "@trigger.dev/core/v3";
3+
import { TriggerTaskRequestBody } from "@trigger.dev/core/v3";
44
import { z } from "zod";
55
import { authenticateApiRequest } from "~/services/apiAuth.server";
66
import { logger } from "~/services/logger.server";
@@ -52,7 +52,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
5252
// Now parse the request body
5353
const anyBody = await request.json();
5454

55-
const body = parseTriggerTaskRequestBody(anyBody);
55+
const body = TriggerTaskRequestBody.safeParse(anyBody);
5656

5757
if (!body.success) {
5858
return json({ error: "Invalid request body" }, { status: 400 });

0 commit comments

Comments
 (0)