#Getting 404 error on /pages/api when deployed to vercel. Working fine on localhost.

5 messages · Page 1 of 1 (latest)

hybrid wagon
#

Problem:

Hi, I've deployed my Next.js app to vercel i've 3 APIs under pages/api/postHistory.js , pages/api/getHistory/index.js & pages/api/getHistory/[address].js.
Everything's working fine except it's giving 404 error when deployed to vercel.

I found some solutions stating to remove any /api directory from root. I don't have any 😦

sick hornet
#

It could be the unfortunate but common issue of camelCase file names and git - did you recently change the files?

#

E.g. try making the route api/post-history, redeploying, and seeing if they show up

#

Also, you might consider an API like api/history and then accepting GET for the get - better REST API practice.

hybrid wagon
#

Aah. Got it. Let me try with lowercase. And yea recently updated the files