Skip to content

Commit

Permalink
Update rewrite dynamic SSG error (vercel#13724)
Browse files Browse the repository at this point in the history
This error isn't specific to just fallback SSG pages since any dynamic SSG page that is rewritten to can cause the `/_next/data` request to fail also since it currently derived from the the URL. 

This can also fail for `getServerSideProps` since it derives the `/_next/data` URL the same way so might need to be updated to show in that case also
  • Loading branch information
ijjk authored and rokinsky committed Jul 11, 2020
1 parent fa21c57 commit d4caa50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions packages/next/next-server/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,7 @@ export async function renderToHTML(
`Rewrites don't support${
isFallback ? ' ' : ' auto-exported '
}dynamic pages${isFallback ? ' with getStaticProps ' : ' '}yet. ` +
`Using this will cause the page to fail to parse the params on the client${
isFallback ? ' for the fallback page ' : ''
}`
`Using this will cause the page to fail to parse the params on the client`
)
}

Expand Down
5 changes: 2 additions & 3 deletions test/integration/prerender/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,11 @@ const runTests = (dev = false, isEmulatedServerless = false) => {
}

if (dev) {
// TODO: re-enable when this is supported in dev
it.skip('should show error when rewriting to dynamic SSG page', async () => {
it('should show error when rewriting to dynamic SSG page', async () => {
const item = Math.round(Math.random() * 100)
const html = await renderViaHTTP(appPort, `/some-rewrite/${item}`)
expect(html).toContain(
`Rewrites don't support dynamic pages with getStaticProps yet. Using this will cause the page to fail to parse the params on the client for the fallback page`
`Rewrites don't support dynamic pages with getStaticProps yet. Using this will cause the page to fail to parse the params on the client`
)
})

Expand Down

0 comments on commit d4caa50

Please sign in to comment.