sst / open-next

Open source Next.js serverless adapter
https://open-next.js.org
MIT License
3.7k stars 111 forks source link

Implement missing methods from response object to fix the middleware issue in next 14.4.12 or lower. #454

Closed vladiulianbogdan closed 6 days ago

vladiulianbogdan commented 1 week ago

This pull request fixes an issue where the middlewares were not functioning properly with the combination of versions specified below. Specifically, the "Middleware — redirect" functionality was failing to work as expected.

SST v2.43.2 Next.js version : 13.4.12 OpenNext v3.0.2

The error was the following:

TypeError: res.send is not a function
    at Object.fn (/var/task/node_modules/next/dist/server/next-server.js:1933:33)
    at async Router.execute (/var/task/node_modules/next/dist/server/router.js:315:32)
    at async NextNodeServer.runImpl (/var/task/node_modules/next/dist/server/base-server.js:624:29)
    at async NextNodeServer.handleRequestImpl (/var/task/node_modules/next/dist/server/base-server.js:549:20)

The implementation adds the missing methods used by next.

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
open-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 8:40am
changeset-bot[bot] commented 1 week ago

⚠️ No Changeset found

Latest commit: c79888d94e9f113703c065a49468292debc9893e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR