Skip to content
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/warm-eagles-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

Fixed misleading error message in the CLI when config file is missing ("maxDuration" is now required). A useful error message is now shown, including a hint about the `--config` flag.
16 changes: 16 additions & 0 deletions packages/cli-v3/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { prettyWarning } from "./utilities/cliOutput.js";
import type { InstrumentationModuleDefinition } from "@opentelemetry/instrumentation";
import { builtinModules } from "node:module";
import { OutroCommandError } from "./cli/common.js";

export type ResolveConfigOptions = {
cwd?: string;
Expand Down Expand Up @@ -162,6 +163,21 @@ async function resolveConfig(
? dirname(packageJsonPath)
: cwd;

// `trigger.config` is the fallback value set by c12
const missingConfigFile = !result.configFile || result.configFile === "trigger.config";

if (missingConfigFile) {
throw new OutroCommandError(
[
"Couldn't find your trigger.config.ts file.",
"",
"Make sure you are in the directory of your Trigger.dev project, or specify the path to your config file using the `--config <path>` flag.",
"",
"Alternatively, you can initialize a new project using `npx trigger.dev@latest init`.",
].join("\n")
);
}

const config =
"config" in result.config ? (result.config.config as TriggerConfig) : result.config;

Expand Down