Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix static 404 & 500 in page router #422

Merged
merged 3 commits into from
May 24, 2024
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
5 changes: 5 additions & 0 deletions .changeset/curly-points-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"open-next": patch
---

Fix static 404 and 500 in page router
2 changes: 1 addition & 1 deletion packages/open-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"access": "public"
},
"name": "open-next",
"version": "3.0.1-middleware-fix",
"version": "3.0.1",
"bin": {
"open-next": "./dist/index.js"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/open-next/src/build/copyTracedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ See the docs for more information on how to bundle edge runtime functions.
filesToCopy.set(f, f.replace(standaloneDir, outputDir));
});

if (!existsSync(path.join(standaloneNextDir, `${fullFilePath}`))) {
throw new Error(
`This error should only happen for static 404 and 500 page from page router. Report this if that's not the case.,
File ${fullFilePath} does not exist`,
);
}

filesToCopy.set(
path.join(standaloneNextDir, fullFilePath),
path.join(outputNextDir, fullFilePath),
Expand Down
Loading