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(
|
||||
indexerToWorkerMessages,
|
||||
|
||||
@@ -219,6 +219,7 @@ const zodIpc = new ZodIpcConnection({
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
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: {
|
||||
durationMs: 0,
|
||||
@@ -248,6 +249,8 @@ const zodIpc = new ZodIpcConnection({
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
code: TaskRunErrorCodes.COULD_NOT_IMPORT_TASK,
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
stackTrace: err instanceof Error ? err.stack : undefined,
|
||||
},
|
||||
usage: {
|
||||
durationMs: 0,
|
||||
|
||||
@@ -219,6 +219,8 @@ const zodIpc = new ZodIpcConnection({
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
code: TaskRunErrorCodes.COULD_NOT_IMPORT_TASK,
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
stackTrace: err instanceof Error ? err.stack : undefined,
|
||||
},
|
||||
usage: {
|
||||
durationMs: 0,
|
||||
|
||||
@@ -49,6 +49,7 @@ export async function indexWorkerManifest({
|
||||
OTEL_IMPORT_HOOK_EXCLUDES: otelHookExclude?.join(","),
|
||||
TRIGGER_BUILD_MANIFEST_PATH: buildManifestPath,
|
||||
NODE_OPTIONS: nodeOptions,
|
||||
TRIGGER_INDEXING: "1",
|
||||
},
|
||||
execPath: execPathForRuntime(runtime),
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ let headerGenerator = new HeaderGenerator({
|
||||
|
||||
export const fetchPostTask = task({
|
||||
id: "fetch-post-task",
|
||||
machine: { preset: "small-1x" },
|
||||
run: async (payload: { url: string }) => {
|
||||
const headers = headerGenerator.getHeaders({
|
||||
operatingSystems: ["linux"],
|
||||
|
||||
@@ -13,7 +13,7 @@ export { handleError } from "./src/handleError.js";
|
||||
export default defineConfig({
|
||||
runtime: "node",
|
||||
project: "yubjwjsfkxnylobaqvqz",
|
||||
machine: "small-2x",
|
||||
machine: "medium-1x",
|
||||
instrumentations: [new OpenAIInstrumentation()],
|
||||
additionalFiles: ["wrangler/wrangler.toml"],
|
||||
retries: {
|
||||
|
||||
Reference in New Issue
Block a user