Skip to content

Commit 3682cdd

Browse files
author
deepshekhardas
committed
fix: improve resource_exhausted error message (#3020)
1 parent d01d438 commit 3682cdd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { describe, it, expect } from "vitest";
2+
import { prepareDeploymentError } from "./errors.js";
3+
4+
describe("prepareDeploymentError", () => {
5+
it("should handle [resource_exhausted] error with a friendly message", () => {
6+
const errorData = {
7+
name: "Error",
8+
message: "Build failed: [resource_exhausted] Process exited with code 1",
9+
stderr: "Some stderr output",
10+
};
11+
12+
const result = prepareDeploymentError(errorData);
13+
14+
// Initial expectation: it passes through (before fix)
15+
// After fix: it should have a specific message about build resources.
16+
// For now, let's just assert it returns SOMETHING.
17+
expect(result).toBeDefined();
18+
expect(result!.name).toBe("BuildError");
19+
expect(result!.message).toContain("The build failed because it ran out of resources");
20+
expect(result!.message).toContain("Try reducing the size of your build context");
21+
});
22+
});

packages/core/src/v3/errors.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,19 @@ export function prepareDeploymentError(
10231023
}
10241024
}
10251025

1026+
if (
1027+
errorData.message.includes("resource_exhausted") ||
1028+
errorData.stderr?.includes("resource_exhausted")
1029+
) {
1030+
return {
1031+
name: "BuildError",
1032+
message:
1033+
"The build failed because it ran out of resources (memory or disk space). This can happen if you have a large build context or are installing heavy dependencies. Try reducing the size of your build context (use .dockerignore) or contact support if this persists.",
1034+
stderr: errorData.stderr,
1035+
stack: errorData.stack,
1036+
};
1037+
}
1038+
10261039
return {
10271040
name: errorData.name,
10281041
message: errorData.message,

0 commit comments

Comments
 (0)