未验证 提交 8193df53 编写于 作者: J JJ Kasper 提交者: GitHub

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
上级 ce7ca248
......@@ -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}/'),
......
......@@ -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', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册