trigger.dev 0.0.0-v3-prerelease-20240427071154 → 0.0.0-v3-prerelease-20240501131706
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/Containerfile.prod
CHANGED
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-
|
|
802
|
+
var version = "0.0.0-v3-prerelease-20240501131706";
|
|
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-
|
|
819
|
+
"@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240501131706",
|
|
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
|
|
1680
|
-
const
|
|
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,
|
|
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
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
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}"`,
|
|
@@ -4593,7 +4592,16 @@ If this is unexpected you should check your ${terminalLink2(
|
|
|
4593
4592
|
throw new SkipLoggingError("Failed to resolve dependencies");
|
|
4594
4593
|
}
|
|
4595
4594
|
const containerFilePath = join6(cliRootPath(), "Containerfile.prod");
|
|
4596
|
-
|
|
4595
|
+
let containerFileContents = readFileSync2(containerFilePath, "utf-8");
|
|
4596
|
+
if (config.postInstall) {
|
|
4597
|
+
containerFileContents = containerFileContents.replace(
|
|
4598
|
+
"__POST_INSTALL__",
|
|
4599
|
+
`RUN ${config.postInstall}`
|
|
4600
|
+
);
|
|
4601
|
+
} else {
|
|
4602
|
+
containerFileContents = containerFileContents.replace("__POST_INSTALL__", "");
|
|
4603
|
+
}
|
|
4604
|
+
await writeFile2(join6(tempDir, "Containerfile"), containerFileContents);
|
|
4597
4605
|
const contentHasher = createHash("sha256");
|
|
4598
4606
|
contentHasher.update(Buffer.from(entryPointOutputFile.text));
|
|
4599
4607
|
contentHasher.update(Buffer.from(workerOutputFile.text));
|
|
@@ -5591,22 +5599,26 @@ async function startDev(dir, options, authorization, dashboardUrl) {
|
|
|
5591
5599
|
configFile: options.config
|
|
5592
5600
|
});
|
|
5593
5601
|
logger.debug("Initial config", { config });
|
|
5602
|
+
if (config.status === "error") {
|
|
5603
|
+
logger.error("Failed to read config", config.error);
|
|
5604
|
+
process.exit(1);
|
|
5605
|
+
}
|
|
5594
5606
|
async function getDevReactElement(configParam, authorization2, configPath) {
|
|
5595
5607
|
const accessToken = authorization2.accessToken;
|
|
5596
5608
|
const apiUrl = authorization2.apiUrl;
|
|
5597
5609
|
apiClient = new CliApiClient(apiUrl, accessToken);
|
|
5598
5610
|
const devEnv = await apiClient.getProjectEnv({
|
|
5599
|
-
projectRef:
|
|
5611
|
+
projectRef: configParam.project,
|
|
5600
5612
|
env: "dev"
|
|
5601
5613
|
});
|
|
5602
5614
|
if (!devEnv.success) {
|
|
5603
5615
|
if (devEnv.error === "Project not found") {
|
|
5604
5616
|
logger.error(
|
|
5605
|
-
`Project not found: ${
|
|
5617
|
+
`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
5618
|
);
|
|
5607
5619
|
} else {
|
|
5608
5620
|
logger.error(
|
|
5609
|
-
`Failed to initialize dev environment: ${devEnv.error}. Using project ref ${
|
|
5621
|
+
`Failed to initialize dev environment: ${devEnv.error}. Using project ref ${configParam.project}`
|
|
5610
5622
|
);
|
|
5611
5623
|
}
|
|
5612
5624
|
process.exit(1);
|
|
@@ -5780,7 +5792,7 @@ function useDev({
|
|
|
5780
5792
|
sourcefile: "__entryPoint.ts"
|
|
5781
5793
|
},
|
|
5782
5794
|
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" }); });`
|
|
5795
|
+
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
5796
|
},
|
|
5785
5797
|
bundle: true,
|
|
5786
5798
|
metafile: true,
|
|
@@ -5951,10 +5963,10 @@ function useDev({
|
|
|
5951
5963
|
return;
|
|
5952
5964
|
} else {
|
|
5953
5965
|
}
|
|
5954
|
-
if (e.originalError.stack) {
|
|
5966
|
+
if (e.originalError.message || e.originalError.stack) {
|
|
5955
5967
|
logger.log(
|
|
5956
5968
|
`${chalkError("X Error:")} Worker failed to start`,
|
|
5957
|
-
e.originalError.stack
|
|
5969
|
+
e.originalError.stack ?? e.originalError.message
|
|
5958
5970
|
);
|
|
5959
5971
|
}
|
|
5960
5972
|
return;
|