diff --git a/.changeset/spotty-ducks-punch.md b/.changeset/spotty-ducks-punch.md new file mode 100644 index 0000000000..f6c0298011 --- /dev/null +++ b/.changeset/spotty-ducks-punch.md @@ -0,0 +1,5 @@ +--- +"trigger.dev": patch +--- + +fix: default machine config indexing now works diff --git a/packages/cli-v3/src/entryPoints/dev-index-worker.ts b/packages/cli-v3/src/entryPoints/dev-index-worker.ts index 86528a93fe..be4b67125b 100644 --- a/packages/cli-v3/src/entryPoints/dev-index-worker.ts +++ b/packages/cli-v3/src/entryPoints/dev-index-worker.ts @@ -128,6 +128,22 @@ if (typeof config.maxDuration === "number") { }); } +// If the config has a machine preset, we need to apply it to all tasks that don't have a machine preset +if (typeof config.machine === "string") { + tasks = tasks.map((task) => { + if (typeof task.machine?.preset !== "string") { + return { + ...task, + machine: { + preset: config.machine, + }, + } satisfies TaskManifest; + } + + return task; + }); +} + await sendMessageInCatalog( indexerToWorkerMessages, "INDEX_COMPLETE", diff --git a/packages/cli-v3/src/entryPoints/managed-index-worker.ts b/packages/cli-v3/src/entryPoints/managed-index-worker.ts index 86528a93fe..be4b67125b 100644 --- a/packages/cli-v3/src/entryPoints/managed-index-worker.ts +++ b/packages/cli-v3/src/entryPoints/managed-index-worker.ts @@ -128,6 +128,22 @@ if (typeof config.maxDuration === "number") { }); } +// If the config has a machine preset, we need to apply it to all tasks that don't have a machine preset +if (typeof config.machine === "string") { + tasks = tasks.map((task) => { + if (typeof task.machine?.preset !== "string") { + return { + ...task, + machine: { + preset: config.machine, + }, + } satisfies TaskManifest; + } + + return task; + }); +} + await sendMessageInCatalog( indexerToWorkerMessages, "INDEX_COMPLETE", diff --git a/references/hello-world/src/trigger/example.ts b/references/hello-world/src/trigger/example.ts index ae3a65007d..8764638ebd 100644 --- a/references/hello-world/src/trigger/example.ts +++ b/references/hello-world/src/trigger/example.ts @@ -37,6 +37,7 @@ export const helloWorldTask = task({ export const parentTask = task({ id: "parent", + machine: "medium-1x", run: async (payload: any, { ctx }) => { logger.log("Hello, world from the parent", { payload }); await childTask.triggerAndWait( diff --git a/references/hello-world/trigger.config.ts b/references/hello-world/trigger.config.ts index 9d31dd312a..6712952fdf 100644 --- a/references/hello-world/trigger.config.ts +++ b/references/hello-world/trigger.config.ts @@ -15,6 +15,7 @@ export default defineConfig({ randomize: true, }, }, + machine: "large-1x", build: { extensions: [ {