trigger.dev 0.0.0-v3-typescript-fix-20240426160144 → 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-typescript-fix-20240426160144";
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-typescript-fix-20240426160144",
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) {
@@ -3778,6 +3785,11 @@ async function _deployCommand(dir, options) {
3778
3785
  configFile: options.config,
3779
3786
  projectRef: options.projectRef
3780
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
+ }
3781
3793
  logger.debug("Resolved config", { resolvedConfig });
3782
3794
  span?.setAttributes({
3783
3795
  "resolvedConfig.status": resolvedConfig.status,
@@ -4431,6 +4443,9 @@ async function compileProject(config, options, configPath) {
4431
4443
  // This is needed to support opentelemetry instrumentation that uses module patching
4432
4444
  target: ["node18", "es2020"],
4433
4445
  outdir: "out",
4446
+ banner: {
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" } }); } });`
4448
+ },
4434
4449
  define: {
4435
4450
  TRIGGER_API_URL: `"${config.triggerUrl}"`,
4436
4451
  __PROJECT_CONFIG__: JSON.stringify(config)
@@ -5575,22 +5590,26 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5575
5590
  configFile: options.config
5576
5591
  });
5577
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
+ }
5578
5597
  async function getDevReactElement(configParam, authorization2, configPath) {
5579
5598
  const accessToken = authorization2.accessToken;
5580
5599
  const apiUrl = authorization2.apiUrl;
5581
5600
  apiClient = new CliApiClient(apiUrl, accessToken);
5582
5601
  const devEnv = await apiClient.getProjectEnv({
5583
- projectRef: config.config.project,
5602
+ projectRef: configParam.project,
5584
5603
  env: "dev"
5585
5604
  });
5586
5605
  if (!devEnv.success) {
5587
5606
  if (devEnv.error === "Project not found") {
5588
5607
  logger.error(
5589
- `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}`
5590
5609
  );
5591
5610
  } else {
5592
5611
  logger.error(
5593
- `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}`
5594
5613
  );
5595
5614
  }
5596
5615
  process.exit(1);
@@ -5763,6 +5782,9 @@ function useDev({
5763
5782
  resolveDir: process.cwd(),
5764
5783
  sourcefile: "__entryPoint.ts"
5765
5784
  },
5785
+ banner: {
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" }); } });`
5787
+ },
5766
5788
  bundle: true,
5767
5789
  metafile: true,
5768
5790
  write: false,
@@ -5932,10 +5954,10 @@ function useDev({
5932
5954
  return;
5933
5955
  } else {
5934
5956
  }
5935
- if (e.originalError.stack) {
5957
+ if (e.originalError.message || e.originalError.stack) {
5936
5958
  logger.log(
5937
5959
  `${chalkError("X Error:")} Worker failed to start`,
5938
- e.originalError.stack
5960
+ e.originalError.stack ?? e.originalError.message
5939
5961
  );
5940
5962
  }
5941
5963
  return;