Vercel responding with 405 for a api route
the api path is correct, i think vercel thinks of it as a static route
13 Replies
If using App Router, you're using a method (GET, POST, etc) that you did not declare or export in your
route.ts
nope im on pages
i have tried a simple different route and its the same issue
Can't reproduce it on my end. Make sure you delete your
.next
folder et restart the server... just in caseDo you have the src folder pattern or everything is in the root dir?
im not using the src folder as well
i even downgraded to the 12 version
same issue still
can you upload some sample code in codesandbox so that we can take a look?
also it does work fine locally
the issue take place using vercel
will do
i've forget that vercel provide logs
fixed it
ty anyway
Maybe you could add a very quick explanation of what was happening, and mark the question as resolved, so that it can help others in your case
it is a pretty tricky issue tbh, basically the API routes that uses the prisma client get blockedon vercel if you don't generate the schema types, using "prisma generate"
Solution
logs: