opennextjs / opennextjs-netlify

Open Next.js adapter for Netlify
https://opennext.js.org/netlify
679 stars 87 forks source link

[v15 canary] Dynamic routes with `fallback: true` are failing with cache error #2627

Closed orinokai closed 1 month ago

orinokai commented 2 months ago

Non-prerendered paths on dynamic routes no longer work when the fallback: true option is used. The response is a 500 and the error is as follows: cache entry required but not generated.

The following test: https://github.com/vercel/next.js/blob/v15.0.0-canary.171/test/e2e/prerender-crawler.test.ts#L61-L69

...fails for the following fixture: https://github.com/vercel/next.js/blob/v15.0.0-canary.171/test/e2e/prerender-crawler.test.ts#L10-L51

We have tests in place for dynamic routes, so it's likely this is solely related to fallback: true, which should render a fallback component while the page is generated in the background.

The error appears to have been introduced in canary 114, but this was a large update that could have obscured a previous issue.

FAIL test/e2e/prerender-crawler.test.ts (78.216 s)
  Prerender crawler handling
    ✓ should return prerendered page for correctly (901 ms)
    ✕ should return fallback for non-crawler correctly (370 ms)
    ✓ should block for crawler correctly (3283 ms)

  ● Prerender crawler handling › should return fallback for non-crawler correctly

    FetchError: Invalid response body while trying to fetch https://66d298ca3b06cc9fe8162eff--next-e2e-tests.netlify.app/blog/test-1: incorrect header check

      at Gunzip.<anonymous> (../node_modules/.pnpm/node-fetch@2.6.7_encoding@0.1.13/node_modules/node-fetch/lib/index.js:400:12)

Data

The following is parsed automatically by the Next.js repo e2e test report generator.

test: Prerender crawler handling should return prerendered page for correctly reason: Non-prerendered dynamic routes with fallback: true are failing with cache error