Skip to content

Commit f85cf44

Browse files
Copilotstyfle
andauthored
Differentiate timeout vs prebuilt binary failure in 500 error message (#1087)
The 500 error page always blamed "no prebuilt binary" regardless of cause. When the install aborts after the 26s timeout, users should see a timeout-specific message instead. - **`src/pages/_document.tsx`**: Detect `ABORT_ERR` code on caught errors, pass `isTimeout` prop to `<ServerError>` - **`src/pages/500.tsx`**: Conditionally render timeout message ("package took too long to install") vs the existing prebuilt binary message When a timeout occurs, the user now sees: > *"This can happen when the package took too long to install and the request timed out."* Instead of the misleading prebuilt binary message. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: styfle <229881+styfle@users.noreply.github.com> Co-authored-by: Steven <steven@ceriously.com>
1 parent fbc31ce commit f85cf44

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/pages/500.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@ import PageContainer from '../components/PageContainer';
66

77
import { pages } from '../util/constants';
88

9-
export default ({ reqId }: { reqId: string }) => (
9+
export default ({ reqId, isTimeout }: { reqId: string; isTimeout?: boolean }) => (
1010
<>
1111
<PageContainer>
1212
<div style={{ textAlign: 'center', marginBottom: '2rem' }}>
1313
<h1>500 Internal Server Error</h1>
1414

1515
<p>Oops, the package failed to install.</p>
1616
<p style={{ maxWidth: '500px' }}>
17-
This can happen when there is no prebuilt binary for node@
18-
{process.versions.node} or the install script requires CLIs like
19-
python/curl/etc.
17+
{isTimeout ? (
18+
'This can happen when the package took too long to install and the request timed out.'
19+
) : (
20+
<>
21+
This can happen when there is no prebuilt binary for node@
22+
{process.versions.node} or the install script requires CLIs like
23+
python/curl/etc.
24+
</>
25+
)}
2026
</p>
2127
<p>
2228
<a href={pages.index}>Go Home</a>

src/pages/_document.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ async function routePage(
253253
if (err instanceof NotFoundError) {
254254
return <NotFound resource={err.resource} />;
255255
}
256+
const isTimeout =
257+
err instanceof Error && 'code' in err && (err as any).code === 'ABORT_ERR';
256258
console.error('Unexpected Error Occurred...', err);
257-
return <ServerError reqId={reqId} />;
259+
return <ServerError reqId={reqId} isTimeout={isTimeout} />;
258260
}
259261
}
260262

0 commit comments

Comments
 (0)