Open ahmetskilinc opened 1 week ago
This is because Payload overwrites the next api funtionallity. I've work around this by putting my own api's in a folder apiv2 and using apiv2/{endpoint_name}
Not the prettiest, but it works.
Just stumbled across the same issue. Creating custom endpoint in collection like so:
endpoints: [
{
path: '/custom-endpoint',
method: 'put',
handler: async (req) => {
return Response.json({ success: true })
}
}
]
Gives 405 Method not allowed when making fetch call from client.
EDIT: Version v3.0.0-beta.117
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