Skip to content

Changed Request to NextRequest to solve the error #2215

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SamDingore
Copy link

error: Argument of type 'Request' is not assignable to parameter of type 'RequestLike'

🔎 Previews:

What does this solve?

This PR fixes a type error caused when passing a Request object to a function expecting a RequestLike type. Specifically, using the native Request object was leading to the following error:

EditArgument of type 'Request' is not assignable to parameter of type 'RequestLike'

This change ensures compatibility with Next.js middleware expectations. More context: this error typically appears when working with Next.js middleware or API routes, which expect a NextRequest instead of a standard Request.

What changed?

  • Replaced instances of the standard Request object with NextRequest to match the expected RequestLike interface.
  • This resolves the type mismatch and aligns the implementation with Next.js middleware type expectations.

Checklist

  • I have clicked on "Files changed" and performed a thorough self-review
  • All existing checks pass

error:  Argument of type 'Request' is not assignable to parameter of type 'RequestLike'
@SamDingore SamDingore requested a review from a team as a code owner May 3, 2025 09:10
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.

1 participant