Skip to content

fix: default machine config indexing now works #1979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-ducks-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

fix: default machine config indexing now works
16 changes: 16 additions & 0 deletions packages/cli-v3/src/entryPoints/dev-index-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions packages/cli-v3/src/entryPoints/managed-index-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions references/hello-world/src/trigger/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions references/hello-world/trigger.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default defineConfig({
randomize: true,
},
},
machine: "large-1x",
build: {
extensions: [
{
Expand Down
Loading