trigger.dev 0.0.0-v3-prerelease-20240427071154 → 0.0.0-v3-prelease-20240429132319

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -799,7 +799,7 @@ import invariant from "tiny-invariant";
799
799
  import { z as z4 } from "zod";
800
800
 
801
801
  // package.json
802
- var version = "0.0.0-v3-prerelease-20240427071154";
802
+ var version = "0.0.0-v3-prelease-20240429132319";
803
803
  var dependencies = {
804
804
  "@anatine/esbuild-decorators": "^0.2.19",
805
805
  "@clack/prompts": "^0.7.0",
@@ -816,7 +816,7 @@ var dependencies = {
816
816
  "@opentelemetry/sdk-trace-base": "^1.22.0",
817
817
  "@opentelemetry/sdk-trace-node": "^1.22.0",
818
818
  "@opentelemetry/semantic-conventions": "^1.22.0",
819
- "@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240427071154",
819
+ "@trigger.dev/core": "workspace:0.0.0-v3-prelease-20240429132319",
820
820
  "@types/degit": "^2.8.3",
821
821
  chalk: "^5.2.0",
822
822
  chokidar: "^3.5.3",
@@ -1676,11 +1676,11 @@ async function readConfig(dir, options) {
1676
1676
  const configPath = await getConfigPath(dir, options?.configFile);
1677
1677
  if (!configPath) {
1678
1678
  if (options?.projectRef) {
1679
- const rawConfig2 = await normalizeConfig({ project: options.projectRef });
1680
- const config2 = Config.parse(rawConfig2);
1679
+ const rawConfig = await normalizeConfig({ project: options.projectRef });
1680
+ const config = Config.parse(rawConfig);
1681
1681
  return {
1682
1682
  status: "in-memory",
1683
- config: await resolveConfig(absoluteDir, config2)
1683
+ config: await resolveConfig(absoluteDir, config)
1684
1684
  };
1685
1685
  } else {
1686
1686
  throw new Error(`Config file not found in ${absoluteDir} or any parent directory.`);
@@ -1713,17 +1713,24 @@ async function readConfig(dir, options) {
1713
1713
  })
1714
1714
  ]
1715
1715
  });
1716
- const userConfigModule = await import(builtConfigFileHref);
1717
- const rawConfig = await normalizeConfig(
1718
- userConfigModule?.config,
1719
- options?.projectRef ? { project: options?.projectRef } : void 0
1720
- );
1721
- const config = Config.parse(rawConfig);
1722
- return {
1723
- status: "file",
1724
- config: await resolveConfig(absoluteDir, config),
1725
- path: configPath
1726
- };
1716
+ try {
1717
+ const userConfigModule = await import(builtConfigFileHref);
1718
+ const rawConfig = await normalizeConfig(
1719
+ userConfigModule?.config,
1720
+ options?.projectRef ? { project: options?.projectRef } : void 0
1721
+ );
1722
+ const config = Config.parse(rawConfig);
1723
+ return {
1724
+ status: "file",
1725
+ config: await resolveConfig(absoluteDir, config),
1726
+ path: configPath
1727
+ };
1728
+ } catch (error) {
1729
+ return {
1730
+ status: "error",
1731
+ error
1732
+ };
1733
+ }
1727
1734
  }
1728
1735
  async function resolveConfig(path7, config) {
1729
1736
  if (!config.triggerDirectories) {
@@ -3683,8 +3690,7 @@ var DeployCommandOptions = CommonCommandOptions.extend({
3683
3690
  outputMetafile: z4.string().optional(),
3684
3691
  apiUrl: z4.string().optional(),
3685
3692
  saveLogs: z4.boolean().default(false),
3686
- skipUpdateCheck: z4.boolean().default(false),
3687
- noCache: z4.boolean().default(false)
3693
+ skipUpdateCheck: z4.boolean().default(false)
3688
3694
  });
3689
3695
  function configureDeployCommand(program2) {
3690
3696
  return commonOptions(
@@ -3701,11 +3707,6 @@ function configureDeployCommand(program2) {
3701
3707
  "--self-hosted",
3702
3708
  "Build and load the image using your local Docker. Use the --registry option to specify the registry to push the image to when using --self-hosted, or just use --push-image to push to the default registry."
3703
3709
  ).hideHelp()
3704
- ).addOption(
3705
- new CommandOption(
3706
- "--no-cache",
3707
- "Do not use the cache when building the image. This will slow down the build process but can be useful if you are experiencing issues with the cache."
3708
- ).hideHelp()
3709
3710
  ).addOption(
3710
3711
  new CommandOption(
3711
3712
  "--push",
@@ -3784,6 +3785,11 @@ async function _deployCommand(dir, options) {
3784
3785
  configFile: options.config,
3785
3786
  projectRef: options.projectRef
3786
3787
  });
3788
+ if (resolvedConfig.status === "error") {
3789
+ logger.error("Failed to read config:", resolvedConfig.error);
3790
+ span && recordSpanException4(span, resolvedConfig.error);
3791
+ throw new SkipLoggingError("Failed to read config");
3792
+ }
3787
3793
  logger.debug("Resolved config", { resolvedConfig });
3788
3794
  span?.setAttributes({
3789
3795
  "resolvedConfig.status": resolvedConfig.status,
@@ -3842,8 +3848,7 @@ async function _deployCommand(dir, options) {
3842
3848
  projectRef: resolvedConfig.config.project,
3843
3849
  buildPlatform: options.buildPlatform,
3844
3850
  pushImage: options.push,
3845
- selfHostedRegistry: !!options.registry,
3846
- noCache: options.noCache
3851
+ selfHostedRegistry: !!options.registry
3847
3852
  });
3848
3853
  }
3849
3854
  if (!deploymentResponse.data.externalBuildData) {
@@ -3866,8 +3871,7 @@ async function _deployCommand(dir, options) {
3866
3871
  contentHash: deploymentResponse.data.contentHash,
3867
3872
  projectRef: resolvedConfig.config.project,
3868
3873
  loadImage: options.loadImage,
3869
- buildPlatform: options.buildPlatform,
3870
- noCache: options.noCache
3874
+ buildPlatform: options.buildPlatform
3871
3875
  },
3872
3876
  deploymentSpinner
3873
3877
  );
@@ -3920,8 +3924,7 @@ async function _deployCommand(dir, options) {
3920
3924
  const startIndexingResponse = await environmentClient.startDeploymentIndexing(
3921
3925
  deploymentResponse.data.id,
3922
3926
  {
3923
- imageReference,
3924
- selfHosted: options.selfHosted
3927
+ imageReference
3925
3928
  }
3926
3929
  );
3927
3930
  if (!startIndexingResponse.success) {
@@ -4181,7 +4184,6 @@ async function buildAndPushImage(options, updater) {
4181
4184
  "build",
4182
4185
  "-f",
4183
4186
  "Containerfile",
4184
- options.noCache ? "--no-cache" : void 0,
4185
4187
  "--platform",
4186
4188
  options.buildPlatform,
4187
4189
  "--provenance",
@@ -4273,7 +4275,6 @@ async function buildAndPushSelfHostedImage(options) {
4273
4275
  "build",
4274
4276
  "-f",
4275
4277
  "Containerfile",
4276
- options.noCache ? "--no-cache" : void 0,
4277
4278
  "--platform",
4278
4279
  options.buildPlatform,
4279
4280
  "--build-arg",
@@ -4291,9 +4292,7 @@ async function buildAndPushSelfHostedImage(options) {
4291
4292
  "."
4292
4293
  // The build context
4293
4294
  ].filter(Boolean);
4294
- logger.debug(`docker ${buildArgs.join(" ")}`, {
4295
- cwd: options.cwd
4296
- });
4295
+ logger.debug(`docker ${buildArgs.join(" ")}`);
4297
4296
  span.setAttribute("docker.command.build", `docker ${buildArgs.join(" ")}`);
4298
4297
  const buildProcess = execa2("docker", buildArgs, {
4299
4298
  cwd: options.cwd
@@ -4445,7 +4444,7 @@ async function compileProject(config, options, configPath) {
4445
4444
  target: ["node18", "es2020"],
4446
4445
  outdir: "out",
4447
4446
  banner: {
4448
- js: `process.on("uncaughtException", function(error, origin) { process.send && process.send({ type: "EVENT", message: { type: "UNCAUGHT_EXCEPTION", payload: { error: { name: error.name, message: error.message, stack: error.stack }, origin }, version: "v1" } }); });`
4447
+ js: `process.on("uncaughtException", function(error, origin) { if (error instanceof Error) { process.send && process.send({ type: "EVENT", message: { type: "UNCAUGHT_EXCEPTION", payload: { error: { name: error.name, message: error.message, stack: error.stack }, origin }, version: "v1" } }); } else { process.send && process.send({ type: "EVENT", message: { type: "UNCAUGHT_EXCEPTION", payload: { error: { name: "Error", message: typeof error === "string" ? error : JSON.stringify(error) }, origin }, version: "v1" } }); } });`
4449
4448
  },
4450
4449
  define: {
4451
4450
  TRIGGER_API_URL: `"${config.triggerUrl}"`,
@@ -5591,22 +5590,26 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5591
5590
  configFile: options.config
5592
5591
  });
5593
5592
  logger.debug("Initial config", { config });
5593
+ if (config.status === "error") {
5594
+ logger.error("Failed to read config", config.error);
5595
+ process.exit(1);
5596
+ }
5594
5597
  async function getDevReactElement(configParam, authorization2, configPath) {
5595
5598
  const accessToken = authorization2.accessToken;
5596
5599
  const apiUrl = authorization2.apiUrl;
5597
5600
  apiClient = new CliApiClient(apiUrl, accessToken);
5598
5601
  const devEnv = await apiClient.getProjectEnv({
5599
- projectRef: config.config.project,
5602
+ projectRef: configParam.project,
5600
5603
  env: "dev"
5601
5604
  });
5602
5605
  if (!devEnv.success) {
5603
5606
  if (devEnv.error === "Project not found") {
5604
5607
  logger.error(
5605
- `Project not found: ${config.config.project}. Ensure you are using the correct project ref and CLI profile (use --profile). Currently using the "${options.profile}" profile, which points to ${authorization2.apiUrl}`
5608
+ `Project not found: ${configParam.project}. Ensure you are using the correct project ref and CLI profile (use --profile). Currently using the "${options.profile}" profile, which points to ${authorization2.apiUrl}`
5606
5609
  );
5607
5610
  } else {
5608
5611
  logger.error(
5609
- `Failed to initialize dev environment: ${devEnv.error}. Using project ref ${config.config.project}`
5612
+ `Failed to initialize dev environment: ${devEnv.error}. Using project ref ${configParam.project}`
5610
5613
  );
5611
5614
  }
5612
5615
  process.exit(1);
@@ -5780,7 +5783,7 @@ function useDev({
5780
5783
  sourcefile: "__entryPoint.ts"
5781
5784
  },
5782
5785
  banner: {
5783
- js: `process.on("uncaughtException", function(error, origin) { process.send && process.send({ type: "UNCAUGHT_EXCEPTION", payload: { error: { name: error.name, message: error.message, stack: error.stack }, origin }, version: "v1" }); });`
5786
+ js: `process.on("uncaughtException", function(error, origin) { if (error instanceof Error) { process.send && process.send({ type: "UNCAUGHT_EXCEPTION", payload: { error: { name: error.name, message: error.message, stack: error.stack }, origin }, version: "v1" }); } else { process.send && process.send({ type: "UNCAUGHT_EXCEPTION", payload: { error: { name: "Error", message: typeof error === "string" ? error : JSON.stringify(error) }, origin }, version: "v1" }); } });`
5784
5787
  },
5785
5788
  bundle: true,
5786
5789
  metafile: true,
@@ -5951,10 +5954,10 @@ function useDev({
5951
5954
  return;
5952
5955
  } else {
5953
5956
  }
5954
- if (e.originalError.stack) {
5957
+ if (e.originalError.message || e.originalError.stack) {
5955
5958
  logger.log(
5956
5959
  `${chalkError("X Error:")} Worker failed to start`,
5957
- e.originalError.stack
5960
+ e.originalError.stack ?? e.originalError.message
5958
5961
  );
5959
5962
  }
5960
5963
  return;