trigger.dev 3.0.0-beta.21 → 3.0.0-beta.23
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 = "3.0.0-beta.
|
|
802
|
+
var version = "3.0.0-beta.23";
|
|
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:3.0.0-beta.
|
|
819
|
+
"@trigger.dev/core": "workspace:3.0.0-beta.23",
|
|
820
820
|
"@types/degit": "^2.8.3",
|
|
821
821
|
chalk: "^5.2.0",
|
|
822
822
|
chokidar: "^3.5.3",
|
|
@@ -855,7 +855,8 @@ var dependencies = {
|
|
|
855
855
|
url: "^0.11.1",
|
|
856
856
|
ws: "^8.12.0",
|
|
857
857
|
zod: "3.22.3",
|
|
858
|
-
"zod-validation-error": "^1.5.0"
|
|
858
|
+
"zod-validation-error": "^1.5.0",
|
|
859
|
+
typescript: "^5.4.0"
|
|
859
860
|
};
|
|
860
861
|
var package_default = {
|
|
861
862
|
name: "trigger.dev",
|
|
@@ -1675,11 +1676,11 @@ async function readConfig(dir, options) {
|
|
|
1675
1676
|
const configPath = await getConfigPath(dir, options?.configFile);
|
|
1676
1677
|
if (!configPath) {
|
|
1677
1678
|
if (options?.projectRef) {
|
|
1678
|
-
const
|
|
1679
|
-
const
|
|
1679
|
+
const rawConfig = await normalizeConfig({ project: options.projectRef });
|
|
1680
|
+
const config = Config.parse(rawConfig);
|
|
1680
1681
|
return {
|
|
1681
1682
|
status: "in-memory",
|
|
1682
|
-
config: await resolveConfig(absoluteDir,
|
|
1683
|
+
config: await resolveConfig(absoluteDir, config)
|
|
1683
1684
|
};
|
|
1684
1685
|
} else {
|
|
1685
1686
|
throw new Error(`Config file not found in ${absoluteDir} or any parent directory.`);
|
|
@@ -1712,17 +1713,24 @@ async function readConfig(dir, options) {
|
|
|
1712
1713
|
})
|
|
1713
1714
|
]
|
|
1714
1715
|
});
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
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
|
+
}
|
|
1726
1734
|
}
|
|
1727
1735
|
async function resolveConfig(path7, config) {
|
|
1728
1736
|
if (!config.triggerDirectories) {
|
|
@@ -3777,6 +3785,11 @@ async function _deployCommand(dir, options) {
|
|
|
3777
3785
|
configFile: options.config,
|
|
3778
3786
|
projectRef: options.projectRef
|
|
3779
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
|
+
}
|
|
3780
3793
|
logger.debug("Resolved config", { resolvedConfig });
|
|
3781
3794
|
span?.setAttributes({
|
|
3782
3795
|
"resolvedConfig.status": resolvedConfig.status,
|
|
@@ -4430,6 +4443,9 @@ async function compileProject(config, options, configPath) {
|
|
|
4430
4443
|
// This is needed to support opentelemetry instrumentation that uses module patching
|
|
4431
4444
|
target: ["node18", "es2020"],
|
|
4432
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
|
+
},
|
|
4433
4449
|
define: {
|
|
4434
4450
|
TRIGGER_API_URL: `"${config.triggerUrl}"`,
|
|
4435
4451
|
__PROJECT_CONFIG__: JSON.stringify(config)
|
|
@@ -5574,22 +5590,26 @@ async function startDev(dir, options, authorization, dashboardUrl) {
|
|
|
5574
5590
|
configFile: options.config
|
|
5575
5591
|
});
|
|
5576
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
|
+
}
|
|
5577
5597
|
async function getDevReactElement(configParam, authorization2, configPath) {
|
|
5578
5598
|
const accessToken = authorization2.accessToken;
|
|
5579
5599
|
const apiUrl = authorization2.apiUrl;
|
|
5580
5600
|
apiClient = new CliApiClient(apiUrl, accessToken);
|
|
5581
5601
|
const devEnv = await apiClient.getProjectEnv({
|
|
5582
|
-
projectRef:
|
|
5602
|
+
projectRef: configParam.project,
|
|
5583
5603
|
env: "dev"
|
|
5584
5604
|
});
|
|
5585
5605
|
if (!devEnv.success) {
|
|
5586
5606
|
if (devEnv.error === "Project not found") {
|
|
5587
5607
|
logger.error(
|
|
5588
|
-
`Project not found: ${
|
|
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}`
|
|
5589
5609
|
);
|
|
5590
5610
|
} else {
|
|
5591
5611
|
logger.error(
|
|
5592
|
-
`Failed to initialize dev environment: ${devEnv.error}. Using project ref ${
|
|
5612
|
+
`Failed to initialize dev environment: ${devEnv.error}. Using project ref ${configParam.project}`
|
|
5593
5613
|
);
|
|
5594
5614
|
}
|
|
5595
5615
|
process.exit(1);
|
|
@@ -5762,6 +5782,9 @@ function useDev({
|
|
|
5762
5782
|
resolveDir: process.cwd(),
|
|
5763
5783
|
sourcefile: "__entryPoint.ts"
|
|
5764
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
|
+
},
|
|
5765
5788
|
bundle: true,
|
|
5766
5789
|
metafile: true,
|
|
5767
5790
|
write: false,
|
|
@@ -5931,10 +5954,10 @@ function useDev({
|
|
|
5931
5954
|
return;
|
|
5932
5955
|
} else {
|
|
5933
5956
|
}
|
|
5934
|
-
if (e.originalError.stack) {
|
|
5957
|
+
if (e.originalError.message || e.originalError.stack) {
|
|
5935
5958
|
logger.log(
|
|
5936
5959
|
`${chalkError("X Error:")} Worker failed to start`,
|
|
5937
|
-
e.originalError.stack
|
|
5960
|
+
e.originalError.stack ?? e.originalError.message
|
|
5938
5961
|
);
|
|
5939
5962
|
}
|
|
5940
5963
|
return;
|