mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 04:22:01 +00:00
[next] fix lambda creation when using edge runtime (#9204)
Co-authored-by: remorses <beats.by.morse@gmail.com>
This commit is contained in:
@@ -2662,7 +2662,7 @@ async function getServerlessPages(params: {
|
||||
for (const edgeFunctionFile of Object.keys(
|
||||
middlewareManifest?.functions ?? {}
|
||||
)) {
|
||||
const edgePath = edgeFunctionFile.slice(1) + '.js';
|
||||
const edgePath = (edgeFunctionFile.slice(1) || 'index') + '.js';
|
||||
delete normalizedAppPaths[edgePath];
|
||||
delete pages[edgePath];
|
||||
}
|
||||
|
||||
@@ -8,6 +8,18 @@ jest.setTimeout(ms('6m'));
|
||||
|
||||
describe(`${__dirname.split(path.sep).pop()}`, () => {
|
||||
it('should normalize routes in build results output', async () => {
|
||||
// TODO: remove after bug with edge functions on Windows
|
||||
// is resolved upstream in Next.js
|
||||
if (process.platform === 'win32') {
|
||||
const indexPage = path.join(__dirname, 'pages/index.tsx');
|
||||
await fs.writeFile(
|
||||
indexPage,
|
||||
(
|
||||
await fs.readFile(indexPage, 'utf8')
|
||||
).replace('runtime: ', '// runtime: ')
|
||||
);
|
||||
}
|
||||
|
||||
const files = [
|
||||
'index.test.js',
|
||||
'next.config.js',
|
||||
@@ -35,5 +47,9 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
|
||||
|
||||
expect(output).toHaveProperty('test/api/hello');
|
||||
expect(output['test/api/hello'].type).toEqual('EdgeFunction');
|
||||
|
||||
for (const name in output) {
|
||||
expect(output[name].type).not.toBe('Lambda');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,3 +9,8 @@ const Home: NextPage = () => {
|
||||
}
|
||||
|
||||
export default Home
|
||||
|
||||
|
||||
export const config = {
|
||||
runtime: 'experimental-edge',
|
||||
}
|
||||
Reference in New Issue
Block a user