Next.js Discord

Discord Forum

Nextjs api not found, but only sometimes

Unanswered
White-collared Seedeater posted this in #help-forum
Open in Discord
Avatar
White-collared SeedeaterOP
Hello. I got some code from a friend and it has a frontend with a button that calls the nextjs api "get-table"


const response = await axios.post("/api/get-table", { //code }



The api is there and it sometimes work, but sometimes the console just throws
POST http://localhost:3000/api/get-table 404 (Not Found)


So my point is the code and the api works. But randomly? There are

And i cant figure out why it does that? Then after some refreshes it works, and then again randomly stops.

Any suggestions or help would be appreciated.

Thanks

4 Replies

Avatar
American Chinchilla
Can you show your route.ts if your using app router
Including the path for this route.ts
Avatar
Barbary Lion
Does this happen on prod as well?
Could be an issue with dev mode
Avatar
Can you show /app/api/get-table/route.ts?