-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(next): update rest route handler types for Next.js 15.5 compatibility #13521
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
Conversation
…are used on static routes.
…are used on static routes.
Had to rebase as I had the wrong commit message, being 15.2 rather than 15.5. |
@rubixvi build is still failing here:
Also I'm not sure this is exactly true:
It seems like Next.js route types are now stricter. Our REST handler is nested within a catch-all I'm going to take a stab at resolving this. I'll try and push to your repo. Update: 0588b61 works, updating the PR description to reflect this. |
Confirmed on my end, updating the type to slug?: string[] resolves the issue. The additional guard isn’t needed since /api correctly falls through to a 404. |
Yea that and if you make an OPTIONS request to |
Hello Everyone!
After reading this thread. I created a project with So I guess the issue is still there when installing payload cms on top of next js. Any suggestions? |
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
@raktimkashyap this patch hasn't been released yet. Our release bot will post a comment here when it goes out. In the meantime you could install one of our nightly canaries, looks like this change went out in v3.54.0-canary.1. |
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
Remove after payloadcms/payload#13521 is released
@jacobsfletch Thanks a lot! I will try out the canary build in the mean time! :) |
🚀 This is included in version v3.54.0 |
Fixes #13527.
When upgrading to Next.js 15.5 with Payload, you might experience a runtime or build error similar to this:
This is because Next.js route types are now stricter. Our REST handler is nested within a catch-all
/api/[...slug]
route, so the slug param will exist in the handler—but the same handler is re-used for the/api/graphql
OPTIONS route, which is not nested within theslug
param and so it will not exist as the types suggest.