Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ describe("isTransientBrowserError", () => {
"Cannot find context with specified id",
"Failed to launch the browser process! TROUBLESHOOTING: https://pptr.dev/troubleshooting",
"connect ECONNREFUSED 127.0.0.1:9222",
"Navigation timeout of 60000 ms exceeded",
])("returns true for transient error: %s", (message) => {
expect(isTransientBrowserError(new Error(message))).toBe(true);
});

it.each([
"net::ERR_NAME_NOT_RESOLVED",
"TimeoutError: Navigation timeout of 30000 ms exceeded",
"FONT_FETCH_FAILED: Inter",
"Composition duration is 0",
"SYSTEM_FONT_USED: -apple-system",
Expand Down
1 change: 1 addition & 0 deletions packages/engine/src/services/frameCapture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,7 @@ const TRANSIENT_BROWSER_ERROR_PATTERNS = [
/Execution context was destroyed/i,
/Cannot find context with specified id/i,
/Failed to launch the browser process/i,
/Navigation timeout of \d+ ms exceeded/i,
/ECONNREFUSED/i,
];

Expand Down
19 changes: 18 additions & 1 deletion packages/producer/src/services/render/stages/probeStage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mock.module("@hyperframes/engine", () => ({
// live in frameCapture-transientErrors.test.ts — update both if patterns change.
isTransientBrowserError: (error: unknown) => {
const msg = error instanceof Error ? error.message : String(error);
return /Navigating frame was detached|Target closed|Session closed|browser has disconnected|Page crashed|Execution context was destroyed|Cannot find context with specified id|Failed to launch the browser process|ECONNREFUSED/i.test(
return /Navigating frame was detached|Target closed|Session closed|browser has disconnected|Page crashed|Execution context was destroyed|Cannot find context with specified id|Failed to launch the browser process|Navigation timeout of \d+ ms exceeded|ECONNREFUSED/i.test(
msg,
);
},
Expand Down Expand Up @@ -276,6 +276,23 @@ describe("runProbeStage — transient browser error retry (#1687)", () => {
expect(result.probeSession).not.toBeNull();
});

it("retries once on a browser-probe navigation timeout and succeeds", async () => {
resetRetryMocks();
capturedCfgs.length = 0;
initializeSessionError = new Error("Navigation timeout of 60000 ms exceeded");
initializeSessionFailUntilAttempt = 1;

const { runProbeStage } = await import("./probeStage.js");
const input = makeProbeInput({ cfgForceScreenshot: false, stageForceScreenshot: false });

const result = await runProbeStage(input);

expect(initializeSessionCallCount).toBe(2);
expect(closeCaptureSessionCallCount).toBe(1);
expect(result.duration).toBe(5);
expect(result.probeSession).not.toBeNull();
});

it("throws immediately on a non-transient error without retrying", async () => {
resetRetryMocks();
capturedCfgs.length = 0;
Expand Down
Loading