Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

vladiulianbogdan
Copy link
Contributor

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.

Copy link

vercel bot commented Jun 26, 2024

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

Copy link

changeset-bot bot commented Jun 26, 2024

⚠️ No Changeset found

Latest commit: c79888d

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

getHeaderValues(name: string): string[] | undefined {
const values = this.getHeader(name);

if (values === undefined) return undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible if the header was somehow set to null?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@conico974 conico974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks!

@conico974 conico974 merged commit 9285014 into opennextjs:main Jun 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants