Skip to content

Deploy is marked as successful if thrown error message is empty #47

@birtles

Description

@birtles

If you do the following in your workflow:

throw new Error('');

The deploy is treated as successful.

Image

Image

Why does this matter? A lot of tasks fail without writing anything to stderr, e.g. sst deploy itself.

As a result, if you do await $`pnpm sst deploy` we write an empty string to WORKFLOW_RESULT file:

` const result = e.name === "ShellError"`,
` ? { error: e.stderr.toString().trim() }`,
` : { error: e.message };`,
` fs.writeFileSync("${WORKFLOW_RESULT}", JSON.stringify(result));`,

That gets transformed into an Error with an empty message here:

try {
shellError = new Error(
JSON.parse(fs.readFileSync(WORKFLOW_RESULT, "utf8")).error,
);
} catch (_) {}
throw shellError;

As a result, even if sst deploy fails (or astro check or tsc --noEmit etc.) the deploy is treated as successful. Furthermore, steps following the error don't run.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions