trigger.dev 0.0.0-v3-prerelease-20240708183321 → 0.0.0-v3-prerelease-20240730135037
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
|
@@ -43,12 +43,14 @@ ARG TRIGGER_DEPLOYMENT_ID
|
|
|
43
43
|
ARG TRIGGER_DEPLOYMENT_VERSION
|
|
44
44
|
ARG TRIGGER_CONTENT_HASH
|
|
45
45
|
ARG TRIGGER_PROJECT_REF
|
|
46
|
+
ARG NODE_EXTRA_CA_CERTS
|
|
46
47
|
|
|
47
48
|
ENV TRIGGER_PROJECT_ID=${TRIGGER_PROJECT_ID} \
|
|
48
49
|
TRIGGER_DEPLOYMENT_ID=${TRIGGER_DEPLOYMENT_ID} \
|
|
49
50
|
TRIGGER_DEPLOYMENT_VERSION=${TRIGGER_DEPLOYMENT_VERSION} \
|
|
50
51
|
TRIGGER_CONTENT_HASH=${TRIGGER_CONTENT_HASH} \
|
|
51
52
|
TRIGGER_PROJECT_REF=${TRIGGER_PROJECT_REF} \
|
|
53
|
+
NODE_EXTRA_CA_CERTS=${NODE_EXTRA_CA_CERTS} \
|
|
52
54
|
NODE_ENV=production
|
|
53
55
|
|
|
54
56
|
USER node
|
package/dist/index.js
CHANGED
|
@@ -798,7 +798,7 @@ import invariant from "tiny-invariant";
|
|
|
798
798
|
import { z as z4 } from "zod";
|
|
799
799
|
|
|
800
800
|
// package.json
|
|
801
|
-
var version = "0.0.0-v3-prerelease-
|
|
801
|
+
var version = "0.0.0-v3-prerelease-20240730135037";
|
|
802
802
|
var dependencies = {
|
|
803
803
|
"@anatine/esbuild-decorators": "^0.2.19",
|
|
804
804
|
"@clack/prompts": "^0.7.0",
|
|
@@ -815,7 +815,7 @@ var dependencies = {
|
|
|
815
815
|
"@opentelemetry/sdk-trace-base": "^1.22.0",
|
|
816
816
|
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
|
817
817
|
"@opentelemetry/semantic-conventions": "^1.22.0",
|
|
818
|
-
"@trigger.dev/core": "workspace:0.0.0-v3-prerelease-
|
|
818
|
+
"@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240730135037",
|
|
819
819
|
"@types/degit": "^2.8.3",
|
|
820
820
|
chalk: "^5.2.0",
|
|
821
821
|
chokidar: "^3.5.3",
|
|
@@ -1321,7 +1321,7 @@ function initializeTracing() {
|
|
|
1321
1321
|
resource,
|
|
1322
1322
|
spanLimits: {
|
|
1323
1323
|
attributeCountLimit: 1e3,
|
|
1324
|
-
attributeValueLengthLimit:
|
|
1324
|
+
attributeValueLengthLimit: 2048,
|
|
1325
1325
|
eventCountLimit: 100,
|
|
1326
1326
|
attributePerEventCountLimit: 100,
|
|
1327
1327
|
linkCountLimit: 10,
|
|
@@ -1793,6 +1793,13 @@ async function resolveConfig(path7, config) {
|
|
|
1793
1793
|
if (!config.tsconfigPath) {
|
|
1794
1794
|
config.tsconfigPath = await findFilePath(path7, "tsconfig.json");
|
|
1795
1795
|
}
|
|
1796
|
+
if (!config.additionalFiles) {
|
|
1797
|
+
config.additionalFiles = [];
|
|
1798
|
+
}
|
|
1799
|
+
if (config.extraCACerts) {
|
|
1800
|
+
config.additionalFiles.push(config.extraCACerts);
|
|
1801
|
+
config.extraCACerts = config.extraCACerts.replace(/^(\.[.]?\/)+/, "");
|
|
1802
|
+
}
|
|
1796
1803
|
return config;
|
|
1797
1804
|
}
|
|
1798
1805
|
async function normalizeConfig(config, overrides) {
|
|
@@ -2651,6 +2658,30 @@ URL: ${chalkLink(authentication.auth.apiUrl)}
|
|
|
2651
2658
|
return userData;
|
|
2652
2659
|
}
|
|
2653
2660
|
|
|
2661
|
+
// src/utilities/linux.ts
|
|
2662
|
+
import { spawn } from "child_process";
|
|
2663
|
+
var isLinuxServer = async () => {
|
|
2664
|
+
if (process.platform !== "linux") {
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
const xdgAvailable = await new Promise((res) => {
|
|
2668
|
+
const xdg = spawn("xdg-open");
|
|
2669
|
+
xdg.on("error", (error) => {
|
|
2670
|
+
logger.debug("Error while checking for xdg-open", error);
|
|
2671
|
+
res(false);
|
|
2672
|
+
});
|
|
2673
|
+
xdg.on("spawn", () => {
|
|
2674
|
+
res(true);
|
|
2675
|
+
});
|
|
2676
|
+
xdg.on("exit", (code) => {
|
|
2677
|
+
res(code === 0);
|
|
2678
|
+
});
|
|
2679
|
+
xdg.unref();
|
|
2680
|
+
});
|
|
2681
|
+
logger.debug("xdg-open available:", xdgAvailable);
|
|
2682
|
+
return !xdgAvailable;
|
|
2683
|
+
};
|
|
2684
|
+
|
|
2654
2685
|
// src/commands/login.ts
|
|
2655
2686
|
var LoginCommandOptions = CommonCommandOptions.extend({
|
|
2656
2687
|
apiUrl: z3.string()
|
|
@@ -2793,7 +2824,13 @@ async function login(options) {
|
|
|
2793
2824
|
`Please visit the following URL to login:
|
|
2794
2825
|
${chalkLink(authorizationCodeResult.url)}`
|
|
2795
2826
|
);
|
|
2796
|
-
await
|
|
2827
|
+
if (await isLinuxServer()) {
|
|
2828
|
+
logger.debug(
|
|
2829
|
+
"Will not open login URL automatically, please install `xdg-utils` to change this behavior."
|
|
2830
|
+
);
|
|
2831
|
+
} else {
|
|
2832
|
+
await open_default(authorizationCodeResult.url);
|
|
2833
|
+
}
|
|
2797
2834
|
const getPersonalAccessTokenSpinner = spinner();
|
|
2798
2835
|
getPersonalAccessTokenSpinner.start("Waiting for you to login");
|
|
2799
2836
|
try {
|
|
@@ -3006,7 +3043,7 @@ function workerSetupImportConfigPlugin(configPath) {
|
|
|
3006
3043
|
}
|
|
3007
3044
|
};
|
|
3008
3045
|
}
|
|
3009
|
-
function bundleDependenciesPlugin(buildIdentifier, dependenciesToBundle, tsconfigPath) {
|
|
3046
|
+
function bundleDependenciesPlugin(buildIdentifier, dependencies2, dependenciesToBundle, tsconfigPath) {
|
|
3010
3047
|
const matchPath = tsconfigPath ? createMatchPath(tsconfigPath) : void 0;
|
|
3011
3048
|
function resolvePath(id) {
|
|
3012
3049
|
if (!matchPath) {
|
|
@@ -3038,6 +3075,9 @@ function bundleDependenciesPlugin(buildIdentifier, dependenciesToBundle, tsconfi
|
|
|
3038
3075
|
return void 0;
|
|
3039
3076
|
}
|
|
3040
3077
|
}
|
|
3078
|
+
if (dependencies2[args.path] && !dependencies2[args.path].external) {
|
|
3079
|
+
return void 0;
|
|
3080
|
+
}
|
|
3041
3081
|
logger.debug(`[${buildIdentifier}] Externalizing ${args.path}`, {
|
|
3042
3082
|
...args
|
|
3043
3083
|
});
|
|
@@ -3437,10 +3477,33 @@ var JavascriptProject = class {
|
|
|
3437
3477
|
});
|
|
3438
3478
|
}
|
|
3439
3479
|
}
|
|
3440
|
-
async
|
|
3480
|
+
async extractDirectDependenciesMeta() {
|
|
3481
|
+
return tracer.startActiveSpan(
|
|
3482
|
+
"JavascriptProject.extractDirectDependenciesMeta",
|
|
3483
|
+
async (span) => {
|
|
3484
|
+
const command = await this.#getCommand();
|
|
3485
|
+
span.setAttributes({
|
|
3486
|
+
packageManager: command.name
|
|
3487
|
+
});
|
|
3488
|
+
try {
|
|
3489
|
+
span.end();
|
|
3490
|
+
return await command.extractDirectDependenciesMeta({
|
|
3491
|
+
cwd: this.projectPath
|
|
3492
|
+
});
|
|
3493
|
+
} catch (error) {
|
|
3494
|
+
recordSpanException4(span, error);
|
|
3495
|
+
span.end();
|
|
3496
|
+
logger.debug(`Failed to resolve internal dependencies using ${command.name}`, {
|
|
3497
|
+
error
|
|
3498
|
+
});
|
|
3499
|
+
throw error;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
);
|
|
3503
|
+
}
|
|
3504
|
+
async resolveAll(packageNames) {
|
|
3441
3505
|
return tracer.startActiveSpan("JavascriptProject.resolveAll", async (span) => {
|
|
3442
3506
|
const externalPackages = packageNames.filter((packageName) => !isBuiltInModule(packageName));
|
|
3443
|
-
const opts = { allowDev: false, ...options };
|
|
3444
3507
|
const command = await this.#getCommand();
|
|
3445
3508
|
span.setAttributes({
|
|
3446
3509
|
externalPackages,
|
|
@@ -3468,15 +3531,6 @@ var JavascriptProject = class {
|
|
|
3468
3531
|
});
|
|
3469
3532
|
missingPackageVersions[packageName] = packageJsonVersion;
|
|
3470
3533
|
}
|
|
3471
|
-
if (opts.allowDev) {
|
|
3472
|
-
const devPackageJsonVersion = this.packageJson.devDependencies?.[packageName];
|
|
3473
|
-
if (typeof devPackageJsonVersion === "string") {
|
|
3474
|
-
logger.debug(`Resolved ${packageName} version using devDependencies`, {
|
|
3475
|
-
devPackageJsonVersion
|
|
3476
|
-
});
|
|
3477
|
-
missingPackageVersions[packageName] = devPackageJsonVersion;
|
|
3478
|
-
}
|
|
3479
|
-
}
|
|
3480
3534
|
}
|
|
3481
3535
|
span.setAttributes({
|
|
3482
3536
|
...flattenAttributes2(missingPackageVersions, "missingPackageVersions"),
|
|
@@ -3586,6 +3640,36 @@ var PNPMCommands = class {
|
|
|
3586
3640
|
}
|
|
3587
3641
|
return results;
|
|
3588
3642
|
}
|
|
3643
|
+
async extractDirectDependenciesMeta(options) {
|
|
3644
|
+
const result = await this.#listDirectDependencies(options);
|
|
3645
|
+
logger.debug(`Extracting direct dependencies metadata using ${this.name}`);
|
|
3646
|
+
const results = {};
|
|
3647
|
+
for (const projectPkg of result) {
|
|
3648
|
+
results[projectPkg.name] = { version: projectPkg.version, external: false };
|
|
3649
|
+
if (projectPkg.dependencies) {
|
|
3650
|
+
for (const [name, dep] of Object.entries(projectPkg.dependencies)) {
|
|
3651
|
+
const { version: version2 } = dep;
|
|
3652
|
+
results[name] = {
|
|
3653
|
+
version: version2,
|
|
3654
|
+
external: !version2.startsWith("link:")
|
|
3655
|
+
};
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
return results;
|
|
3660
|
+
}
|
|
3661
|
+
async #listDirectDependencies(options) {
|
|
3662
|
+
const childProcess2 = await $({
|
|
3663
|
+
cwd: options.cwd,
|
|
3664
|
+
reject: false
|
|
3665
|
+
})`${this.cmd} list --recursive --json`;
|
|
3666
|
+
if (childProcess2.failed) {
|
|
3667
|
+
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3668
|
+
error: childProcess2
|
|
3669
|
+
});
|
|
3670
|
+
}
|
|
3671
|
+
return JSON.parse(childProcess2.stdout);
|
|
3672
|
+
}
|
|
3589
3673
|
async #listDependencies(packageNames, options) {
|
|
3590
3674
|
const childProcess2 = await $({
|
|
3591
3675
|
cwd: options.cwd,
|
|
@@ -3593,7 +3677,7 @@ var PNPMCommands = class {
|
|
|
3593
3677
|
})`${this.cmd} list ${packageNames} -r --json`;
|
|
3594
3678
|
if (childProcess2.failed) {
|
|
3595
3679
|
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3596
|
-
error: childProcess2
|
|
3680
|
+
error: childProcess2
|
|
3597
3681
|
});
|
|
3598
3682
|
}
|
|
3599
3683
|
return JSON.parse(childProcess2.stdout);
|
|
@@ -3628,6 +3712,23 @@ var NPMCommands = class {
|
|
|
3628
3712
|
}
|
|
3629
3713
|
return results;
|
|
3630
3714
|
}
|
|
3715
|
+
async extractDirectDependenciesMeta(options) {
|
|
3716
|
+
const result = await this.#listDirectDependencies(options);
|
|
3717
|
+
logger.debug(`Extracting direct dependencies metadata using ${this.name}`);
|
|
3718
|
+
return result.dependencies ? this.#flattenDependenciesMeta(result.dependencies) : {};
|
|
3719
|
+
}
|
|
3720
|
+
async #listDirectDependencies(options) {
|
|
3721
|
+
const childProcess2 = await $({
|
|
3722
|
+
cwd: options.cwd,
|
|
3723
|
+
reject: false
|
|
3724
|
+
})`${this.cmd} list --json`;
|
|
3725
|
+
if (childProcess2.failed) {
|
|
3726
|
+
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3727
|
+
error: childProcess2
|
|
3728
|
+
});
|
|
3729
|
+
}
|
|
3730
|
+
return JSON.parse(childProcess2.stdout);
|
|
3731
|
+
}
|
|
3631
3732
|
async #listDependencies(packageNames, options) {
|
|
3632
3733
|
const childProcess2 = await $({
|
|
3633
3734
|
cwd: options.cwd,
|
|
@@ -3635,7 +3736,7 @@ var NPMCommands = class {
|
|
|
3635
3736
|
})`${this.cmd} list ${packageNames} --json`;
|
|
3636
3737
|
if (childProcess2.failed) {
|
|
3637
3738
|
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3638
|
-
error: childProcess2
|
|
3739
|
+
error: childProcess2
|
|
3639
3740
|
});
|
|
3640
3741
|
}
|
|
3641
3742
|
return JSON.parse(childProcess2.stdout);
|
|
@@ -3653,6 +3754,17 @@ var NPMCommands = class {
|
|
|
3653
3754
|
}
|
|
3654
3755
|
}
|
|
3655
3756
|
}
|
|
3757
|
+
#flattenDependenciesMeta(dependencies2) {
|
|
3758
|
+
let results = {};
|
|
3759
|
+
for (const [name, dep] of Object.entries(dependencies2)) {
|
|
3760
|
+
const { version: version2, resolved, dependencies: children } = dep;
|
|
3761
|
+
results[name] = { version: version2, external: !!resolved && !resolved.startsWith("file:") };
|
|
3762
|
+
if (children) {
|
|
3763
|
+
results = { ...results, ...this.#flattenDependenciesMeta(children) };
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
return results;
|
|
3767
|
+
}
|
|
3656
3768
|
};
|
|
3657
3769
|
var YarnCommands = class {
|
|
3658
3770
|
get name() {
|
|
@@ -3690,6 +3802,30 @@ var YarnCommands = class {
|
|
|
3690
3802
|
}
|
|
3691
3803
|
return results;
|
|
3692
3804
|
}
|
|
3805
|
+
async extractDirectDependenciesMeta(options) {
|
|
3806
|
+
const result = await this.#listDirectDependencies(options);
|
|
3807
|
+
const rawPackagesData = result.split("\n");
|
|
3808
|
+
logger.debug(`Extracting direct dependencies metadata using ${this.name}`);
|
|
3809
|
+
const results = {};
|
|
3810
|
+
for (const rawPackageData of rawPackagesData) {
|
|
3811
|
+
const packageData = JSON.parse(rawPackageData);
|
|
3812
|
+
const [name, dependencyMeta] = this.#parseYarnValueIntoDependencyMeta(packageData.value);
|
|
3813
|
+
results[name] = dependencyMeta;
|
|
3814
|
+
}
|
|
3815
|
+
return results;
|
|
3816
|
+
}
|
|
3817
|
+
async #listDirectDependencies(options) {
|
|
3818
|
+
const childProcess2 = await $({
|
|
3819
|
+
cwd: options.cwd,
|
|
3820
|
+
reject: false
|
|
3821
|
+
})`${this.cmd} info --all --json`;
|
|
3822
|
+
if (childProcess2.failed) {
|
|
3823
|
+
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3824
|
+
error: childProcess2
|
|
3825
|
+
});
|
|
3826
|
+
}
|
|
3827
|
+
return childProcess2.stdout;
|
|
3828
|
+
}
|
|
3693
3829
|
async #listDependencies(packageNames, options) {
|
|
3694
3830
|
const childProcess2 = await $({
|
|
3695
3831
|
cwd: options.cwd,
|
|
@@ -3697,7 +3833,7 @@ var YarnCommands = class {
|
|
|
3697
3833
|
})`${this.cmd} info ${packageNames} --json`;
|
|
3698
3834
|
if (childProcess2.failed) {
|
|
3699
3835
|
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3700
|
-
error: childProcess2
|
|
3836
|
+
error: childProcess2
|
|
3701
3837
|
});
|
|
3702
3838
|
}
|
|
3703
3839
|
return childProcess2.stdout;
|
|
@@ -3713,6 +3849,26 @@ var YarnCommands = class {
|
|
|
3713
3849
|
}
|
|
3714
3850
|
return parts[0];
|
|
3715
3851
|
}
|
|
3852
|
+
#parseYarnValueIntoDependencyMeta(value) {
|
|
3853
|
+
const parts = value.split("@");
|
|
3854
|
+
let name, protocol, version2;
|
|
3855
|
+
if (parts.length === 3) {
|
|
3856
|
+
name = `@${parts[1]}`;
|
|
3857
|
+
[protocol = "", version2 = ""] = parts[2].split(":");
|
|
3858
|
+
} else if (parts.length === 2) {
|
|
3859
|
+
name = parts[0].toString();
|
|
3860
|
+
[protocol = "", version2 = ""] = parts[1].split(":");
|
|
3861
|
+
} else {
|
|
3862
|
+
throw new Error("Failed parsing ${value} into dependency meta");
|
|
3863
|
+
}
|
|
3864
|
+
return [
|
|
3865
|
+
name,
|
|
3866
|
+
{
|
|
3867
|
+
version: version2,
|
|
3868
|
+
external: protocol !== "workspace" && protocol !== "file"
|
|
3869
|
+
}
|
|
3870
|
+
];
|
|
3871
|
+
}
|
|
3716
3872
|
};
|
|
3717
3873
|
function isBuiltInModule(module) {
|
|
3718
3874
|
if (module.startsWith("node:")) {
|
|
@@ -4202,7 +4358,8 @@ ${authorization.error}`
|
|
|
4202
4358
|
buildPlatform: options.buildPlatform,
|
|
4203
4359
|
pushImage: options.push,
|
|
4204
4360
|
selfHostedRegistry: !!options.registry,
|
|
4205
|
-
noCache: options.noCache
|
|
4361
|
+
noCache: options.noCache,
|
|
4362
|
+
extraCACerts: resolvedConfig.config.extraCACerts
|
|
4206
4363
|
});
|
|
4207
4364
|
}
|
|
4208
4365
|
if (!deploymentResponse.data.externalBuildData) {
|
|
@@ -4226,7 +4383,8 @@ ${authorization.error}`
|
|
|
4226
4383
|
projectRef: resolvedConfig.config.project,
|
|
4227
4384
|
loadImage: options.loadImage,
|
|
4228
4385
|
buildPlatform: options.buildPlatform,
|
|
4229
|
-
noCache: options.noCache
|
|
4386
|
+
noCache: options.noCache,
|
|
4387
|
+
extraCACerts: resolvedConfig.config.extraCACerts
|
|
4230
4388
|
},
|
|
4231
4389
|
deploymentSpinner
|
|
4232
4390
|
);
|
|
@@ -4443,6 +4601,14 @@ Did you include it in config.additionalFiles? ${cliLink(
|
|
|
4443
4601
|
docs.config.prisma
|
|
4444
4602
|
)}`
|
|
4445
4603
|
},
|
|
4604
|
+
{
|
|
4605
|
+
regex: /@prisma\/client did not initialize yet/,
|
|
4606
|
+
message: `Prisma client not initialized yet.
|
|
4607
|
+
Did you forget to add the postinstall script? ${cliLink(
|
|
4608
|
+
"Config docs",
|
|
4609
|
+
docs.config.prisma
|
|
4610
|
+
)}`
|
|
4611
|
+
},
|
|
4446
4612
|
{
|
|
4447
4613
|
regex: /sh: 1: (?<packageOrBinary>.*): not found/,
|
|
4448
4614
|
message: `$packageOrBinary not found
|
|
@@ -4563,6 +4729,7 @@ async function buildAndPushImage(options, updater) {
|
|
|
4563
4729
|
`TRIGGER_CONTENT_HASH=${options.contentHash}`,
|
|
4564
4730
|
"--build-arg",
|
|
4565
4731
|
`TRIGGER_PROJECT_REF=${options.projectRef}`,
|
|
4732
|
+
...options.extraCACerts ? ["--build-arg", `NODE_EXTRA_CA_CERTS=${options.extraCACerts}`] : [],
|
|
4566
4733
|
"-t",
|
|
4567
4734
|
`${options.registryHost}/${options.imageTag}`,
|
|
4568
4735
|
".",
|
|
@@ -4653,6 +4820,7 @@ async function buildAndPushSelfHostedImage(options) {
|
|
|
4653
4820
|
`TRIGGER_CONTENT_HASH=${options.contentHash}`,
|
|
4654
4821
|
"--build-arg",
|
|
4655
4822
|
`TRIGGER_PROJECT_REF=${options.projectRef}`,
|
|
4823
|
+
...options.extraCACerts ? ["--build-arg", `NODE_EXTRA_CA_CERTS=${options.extraCACerts}`] : [],
|
|
4656
4824
|
"-t",
|
|
4657
4825
|
imageRef,
|
|
4658
4826
|
"."
|
|
@@ -4824,6 +4992,7 @@ async function compileProject(config, options, configPath) {
|
|
|
4824
4992
|
mockServerOnlyPlugin(),
|
|
4825
4993
|
bundleDependenciesPlugin(
|
|
4826
4994
|
"workerFacade",
|
|
4995
|
+
{},
|
|
4827
4996
|
config.dependenciesToBundle,
|
|
4828
4997
|
config.tsconfigPath
|
|
4829
4998
|
),
|
|
@@ -4875,6 +5044,7 @@ async function compileProject(config, options, configPath) {
|
|
|
4875
5044
|
plugins: [
|
|
4876
5045
|
bundleDependenciesPlugin(
|
|
4877
5046
|
"entryPoint.ts",
|
|
5047
|
+
{},
|
|
4878
5048
|
config.dependenciesToBundle,
|
|
4879
5049
|
config.tsconfigPath
|
|
4880
5050
|
)
|
|
@@ -5707,20 +5877,31 @@ var BackgroundWorker = class {
|
|
|
5707
5877
|
}, 2e4);
|
|
5708
5878
|
child.on("message", async (msg) => {
|
|
5709
5879
|
const message = this._handler.parseMessage(msg);
|
|
5710
|
-
if (message.
|
|
5880
|
+
if (!message.success) {
|
|
5711
5881
|
clearTimeout(timeout);
|
|
5712
5882
|
resolved = true;
|
|
5713
|
-
|
|
5883
|
+
reject(new Error(`Failed to parse message: ${message.error}`));
|
|
5714
5884
|
child.kill();
|
|
5715
|
-
|
|
5885
|
+
return;
|
|
5886
|
+
}
|
|
5887
|
+
if (message.data.type === "TASKS_READY" && !resolved) {
|
|
5716
5888
|
clearTimeout(timeout);
|
|
5717
5889
|
resolved = true;
|
|
5718
|
-
|
|
5890
|
+
resolve6(message.data.payload.tasks);
|
|
5891
|
+
child.kill();
|
|
5892
|
+
} else if (message.data.type === "UNCAUGHT_EXCEPTION") {
|
|
5893
|
+
clearTimeout(timeout);
|
|
5894
|
+
resolved = true;
|
|
5895
|
+
reject(
|
|
5896
|
+
new UncaughtExceptionError(message.data.payload.error, message.data.payload.origin)
|
|
5897
|
+
);
|
|
5719
5898
|
child.kill();
|
|
5720
|
-
} else if (message.type === "TASKS_FAILED_TO_PARSE") {
|
|
5899
|
+
} else if (message.data.type === "TASKS_FAILED_TO_PARSE") {
|
|
5721
5900
|
clearTimeout(timeout);
|
|
5722
5901
|
resolved = true;
|
|
5723
|
-
reject(
|
|
5902
|
+
reject(
|
|
5903
|
+
new TaskMetadataParseError(message.data.payload.zodIssues, message.data.payload.tasks)
|
|
5904
|
+
);
|
|
5724
5905
|
child.kill();
|
|
5725
5906
|
}
|
|
5726
5907
|
});
|
|
@@ -6123,9 +6304,13 @@ var TaskRunProcess = class {
|
|
|
6123
6304
|
}
|
|
6124
6305
|
async #handleMessage(msg) {
|
|
6125
6306
|
const message = this._handler.parseMessage(msg);
|
|
6126
|
-
|
|
6307
|
+
if (!message.success) {
|
|
6308
|
+
logger.error(`Dropping message: ${message.error}`, { message });
|
|
6309
|
+
return;
|
|
6310
|
+
}
|
|
6311
|
+
switch (message.data.type) {
|
|
6127
6312
|
case "TASK_RUN_COMPLETED": {
|
|
6128
|
-
const { result, execution } = message.payload;
|
|
6313
|
+
const { result, execution } = message.data.payload;
|
|
6129
6314
|
logger.debug(`[${this.runId}] task run completed`, {
|
|
6130
6315
|
result
|
|
6131
6316
|
});
|
|
@@ -6151,7 +6336,7 @@ var TaskRunProcess = class {
|
|
|
6151
6336
|
if (this.messageId) {
|
|
6152
6337
|
this.onTaskRunHeartbeat.post(this.messageId);
|
|
6153
6338
|
} else {
|
|
6154
|
-
this.onTaskHeartbeat.post(message.payload.id);
|
|
6339
|
+
this.onTaskHeartbeat.post(message.data.payload.id);
|
|
6155
6340
|
}
|
|
6156
6341
|
break;
|
|
6157
6342
|
}
|
|
@@ -6460,10 +6645,14 @@ function useDev({
|
|
|
6460
6645
|
`${dashboardUrl}/projects/v3/${config.project}`
|
|
6461
6646
|
);
|
|
6462
6647
|
websocket.addEventListener("open", async (event) => {
|
|
6648
|
+
logger.debug("WebSocket opened", { event });
|
|
6463
6649
|
});
|
|
6464
6650
|
websocket.addEventListener("close", (event) => {
|
|
6651
|
+
logger.debug("WebSocket closed", { event });
|
|
6465
6652
|
});
|
|
6466
6653
|
websocket.addEventListener("error", (event) => {
|
|
6654
|
+
logger.log(`${chalkError("WebSocketError:")} ${event.error.message}`);
|
|
6655
|
+
logger.debug("WebSocket error", { event, rawError: event.error });
|
|
6467
6656
|
});
|
|
6468
6657
|
backgroundWorkerCoordinator.onWorkerTaskHeartbeat.attach(
|
|
6469
6658
|
async ({ worker, backgroundWorkerId, id }) => {
|
|
@@ -6521,29 +6710,40 @@ function useDev({
|
|
|
6521
6710
|
});
|
|
6522
6711
|
});
|
|
6523
6712
|
websocket.addEventListener("message", async (event) => {
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6713
|
+
try {
|
|
6714
|
+
const data = JSON.parse(
|
|
6715
|
+
typeof event.data === "string" ? event.data : new TextDecoder("utf-8").decode(event.data)
|
|
6716
|
+
);
|
|
6717
|
+
const messageHandler = new ZodMessageHandler2({
|
|
6718
|
+
schema: serverWebsocketMessages,
|
|
6719
|
+
messages: {
|
|
6720
|
+
SERVER_READY: async (payload) => {
|
|
6721
|
+
for (const worker of backgroundWorkerCoordinator.currentWorkers) {
|
|
6722
|
+
await sender.send("READY_FOR_TASKS", {
|
|
6723
|
+
backgroundWorkerId: worker.id,
|
|
6724
|
+
inProgressRuns: worker.worker.inProgressRuns
|
|
6725
|
+
});
|
|
6726
|
+
}
|
|
6727
|
+
},
|
|
6728
|
+
BACKGROUND_WORKER_MESSAGE: async (payload) => {
|
|
6729
|
+
await backgroundWorkerCoordinator.handleMessage(
|
|
6730
|
+
payload.backgroundWorkerId,
|
|
6731
|
+
payload.data
|
|
6732
|
+
);
|
|
6536
6733
|
}
|
|
6537
|
-
},
|
|
6538
|
-
BACKGROUND_WORKER_MESSAGE: async (payload) => {
|
|
6539
|
-
await backgroundWorkerCoordinator.handleMessage(
|
|
6540
|
-
payload.backgroundWorkerId,
|
|
6541
|
-
payload.data
|
|
6542
|
-
);
|
|
6543
6734
|
}
|
|
6735
|
+
});
|
|
6736
|
+
await messageHandler.handleMessage(data);
|
|
6737
|
+
} catch (error) {
|
|
6738
|
+
if (error instanceof Error) {
|
|
6739
|
+
logger.error("Error while handling websocket message", { error: error.message });
|
|
6740
|
+
} else {
|
|
6741
|
+
logger.error(
|
|
6742
|
+
"Unkown error while handling websocket message, use `-l debug` for additional output"
|
|
6743
|
+
);
|
|
6744
|
+
logger.debug("Error while handling websocket message", { error });
|
|
6544
6745
|
}
|
|
6545
|
-
}
|
|
6546
|
-
await messageHandler.handleMessage(data);
|
|
6746
|
+
}
|
|
6547
6747
|
});
|
|
6548
6748
|
let ctx;
|
|
6549
6749
|
let firstBuild = true;
|
|
@@ -6608,6 +6808,7 @@ function useDev({
|
|
|
6608
6808
|
bundleTriggerDevCore("workerFacade", config.tsconfigPath),
|
|
6609
6809
|
bundleDependenciesPlugin(
|
|
6610
6810
|
"workerFacade",
|
|
6811
|
+
{},
|
|
6611
6812
|
(config.dependenciesToBundle ?? []).concat([/^@trigger.dev/]),
|
|
6612
6813
|
config.tsconfigPath
|
|
6613
6814
|
),
|