Fix default machine preset in config not being used (#1321)
* Add additional error message and stack trace when a task file cannot be imported for run * Apply default machine preset in config
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"trigger.dev": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Apply default machine preset in config
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"trigger.dev": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add additional error message and stack trace when a task file cannot be imported for run
|
||||||
@@ -95,9 +95,25 @@ async function bootstrap() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const { buildManifest, importErrors } = await bootstrap();
|
const { buildManifest, importErrors, config } = await bootstrap();
|
||||||
|
|
||||||
const tasks = taskCatalog.listTaskManifests();
|
let tasks = taskCatalog.listTaskManifests();
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return task;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
await sendMessageInCatalog(
|
await sendMessageInCatalog(
|
||||||
indexerToWorkerMessages,
|
indexerToWorkerMessages,
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ const zodIpc = new ZodIpcConnection({
|
|||||||
error: {
|
error: {
|
||||||
type: "INTERNAL_ERROR",
|
type: "INTERNAL_ERROR",
|
||||||
code: TaskRunErrorCodes.COULD_NOT_FIND_TASK,
|
code: TaskRunErrorCodes.COULD_NOT_FIND_TASK,
|
||||||
|
message: `Could not find task ${execution.task.id}. Make sure the task is exported and the ID is correct.`,
|
||||||
},
|
},
|
||||||
usage: {
|
usage: {
|
||||||
durationMs: 0,
|
durationMs: 0,
|
||||||
@@ -248,6 +249,8 @@ const zodIpc = new ZodIpcConnection({
|
|||||||
error: {
|
error: {
|
||||||
type: "INTERNAL_ERROR",
|
type: "INTERNAL_ERROR",
|
||||||
code: TaskRunErrorCodes.COULD_NOT_IMPORT_TASK,
|
code: TaskRunErrorCodes.COULD_NOT_IMPORT_TASK,
|
||||||
|
message: err instanceof Error ? err.message : String(err),
|
||||||
|
stackTrace: err instanceof Error ? err.stack : undefined,
|
||||||
},
|
},
|
||||||
usage: {
|
usage: {
|
||||||
durationMs: 0,
|
durationMs: 0,
|
||||||
|
|||||||
@@ -219,6 +219,8 @@ const zodIpc = new ZodIpcConnection({
|
|||||||
error: {
|
error: {
|
||||||
type: "INTERNAL_ERROR",
|
type: "INTERNAL_ERROR",
|
||||||
code: TaskRunErrorCodes.COULD_NOT_IMPORT_TASK,
|
code: TaskRunErrorCodes.COULD_NOT_IMPORT_TASK,
|
||||||
|
message: err instanceof Error ? err.message : String(err),
|
||||||
|
stackTrace: err instanceof Error ? err.stack : undefined,
|
||||||
},
|
},
|
||||||
usage: {
|
usage: {
|
||||||
durationMs: 0,
|
durationMs: 0,
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export async function indexWorkerManifest({
|
|||||||
OTEL_IMPORT_HOOK_EXCLUDES: otelHookExclude?.join(","),
|
OTEL_IMPORT_HOOK_EXCLUDES: otelHookExclude?.join(","),
|
||||||
TRIGGER_BUILD_MANIFEST_PATH: buildManifestPath,
|
TRIGGER_BUILD_MANIFEST_PATH: buildManifestPath,
|
||||||
NODE_OPTIONS: nodeOptions,
|
NODE_OPTIONS: nodeOptions,
|
||||||
|
TRIGGER_INDEXING: "1",
|
||||||
},
|
},
|
||||||
execPath: execPathForRuntime(runtime),
|
execPath: execPathForRuntime(runtime),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ let headerGenerator = new HeaderGenerator({
|
|||||||
|
|
||||||
export const fetchPostTask = task({
|
export const fetchPostTask = task({
|
||||||
id: "fetch-post-task",
|
id: "fetch-post-task",
|
||||||
|
machine: { preset: "small-1x" },
|
||||||
run: async (payload: { url: string }) => {
|
run: async (payload: { url: string }) => {
|
||||||
const headers = headerGenerator.getHeaders({
|
const headers = headerGenerator.getHeaders({
|
||||||
operatingSystems: ["linux"],
|
operatingSystems: ["linux"],
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export { handleError } from "./src/handleError.js";
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
runtime: "node",
|
runtime: "node",
|
||||||
project: "yubjwjsfkxnylobaqvqz",
|
project: "yubjwjsfkxnylobaqvqz",
|
||||||
machine: "small-2x",
|
machine: "medium-1x",
|
||||||
instrumentations: [new OpenAIInstrumentation()],
|
instrumentations: [new OpenAIInstrumentation()],
|
||||||
additionalFiles: ["wrangler/wrangler.toml"],
|
additionalFiles: ["wrangler/wrangler.toml"],
|
||||||
retries: {
|
retries: {
|
||||||
|
|||||||
Reference in New Issue
Block a user