Skip to content

Commit

Permalink
fix build id and ssr error
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Jan 25, 2022
1 parent b5e7949 commit e5658f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default async function middlewareSSRLoader(this: any) {
const {
dev,
page,
buildId,
absolutePagePath,
absoluteAppPath,
absoluteDocumentPath,
Expand Down Expand Up @@ -63,6 +64,7 @@ export default async function middlewareSSRLoader(this: any) {
errorMod,
// renderOpts
buildId: ${JSON.stringify(buildId)},
dev: ${JSON.stringify(dev)},
env: process.env,
supportsDynamicHTML: true,
Expand Down
3 changes: 1 addition & 2 deletions packages/next/server/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export default class NextWebServer extends BaseServer {
return ''
}
protected getBuildId() {
// @TODO
return ''
return (globalThis as any).__server_context.buildId
}
protected loadEnvConfig() {
// @TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,8 @@ async function runBasicTests(context, env) {
const $404 = cheerio.load(path404HTML)
expect($404('#__next').text()).toBe(page404Content)

// in dev mode: custom error page is still using default _error
expect(path500HTML).toContain(
isDev ? 'Internal Server Error' : 'custom-500-page'
)
// In dev mode: it should show the error popup.
expect(path500HTML).toContain(isDev ? 'Error: oops' : 'custom-500-page')
expect(pathNotFoundHTML).toContain(page404Content)
})

Expand Down

0 comments on commit e5658f2

Please sign in to comment.