Fix serverless with next start error case (#19288)

This fixes the case where we were returning page data when rendering `/_error` in `serverless` mode with `next start`

Closes: https://github.com/vercel/next.js/issues/19068
This commit is contained in:
JJ Kasper 2020-11-19 10:25:54 -06:00 committed by GitHub
parent ce7ca2487b
commit 8193df5309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -631,7 +631,7 @@ const nextServerlessLoader: loader.Loader = function () {
const {
default: getRouteNoAssetPath,
} = require('next/dist/next-server/lib/router/utils/get-route-from-asset-path');
_nextData = true;
_nextData = ${page === '/_error' ? 'false' : 'true'};
parsedUrl.pathname = getRouteNoAssetPath(
parsedUrl.pathname.replace(
new RegExp('/_next/data/${escapedBuildId}/'),

View file

@ -1785,6 +1785,11 @@ const runTests = (dev = false, isEmulatedServerless = false) => {
})
}
}
// this should come very last
it('should not have attempted sending invalid payload', async () => {
expect(stderr).not.toContain('argument entity must be string')
})
}
describe('SSG Prerender', () => {