-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Endpoint PUT request gives 405 Method not allowed #8807
Comments
This is because Payload overwrites the next api funtionallity. Not the prettiest, but it works. |
Just stumbled across the same issue.
Gives 405 Method not allowed when making fetch call from client. EDIT: Version |
### What? Fixes support for custom endpoints with `method: 'put'`. Previously, this didn't work: ```ts export default buildConfigWithDefaults({ collections: [ ], endpoints: [ { method: 'put', handler: () => new Response(), path: '/put', }, ], }) ``` ### Why? We supported this in 2.0 and docs are saying that we can use `'put'` as `method` https://payloadcms.com/docs/beta/rest-api/overview#custom-endpoints ### How? Implements the `REST_PUT` export for `@payloadcms/next/routes`, updates all templates. Additionally, adds tests to ensure root/collection level custom endpoints with all necessary methods execute properly. Fixes #8807 -->
🚀 This is included in version v3.0.0-beta.125 |
This issue has been automatically locked. |
Describe the Bug
I've added a PUT method to my application inside the payload config and when I hit this endpoint I get a 405 error. GET request works perfectly fine.
Link to the code that reproduces this issue
https://github.com/ahmetskilinc/endpoints-not-working-payload
Reproduction Steps
localhost:3000/api/square-signup
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Payload: 3.0.0-beta.116
NextJS: 15.0.0-canary.198
NodeJS: 20.12.0
React: 19.0.0-rc-b8ae38f8-20241018
The text was updated successfully, but these errors were encountered: