Next.js Discord

Discord Forum

Getting 304 in my API Routes

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Cuvier’s Dwarf CaimanOP
I´m building an app completely in Next.js: Frontend and Backend (has scraping with playwright).
I deployed the app in Vercel but my Backend returns 304 on every endpoint. This doesn't happen in local. What could it be?

17 Replies

@Cuvier’s Dwarf Caiman I don't think it's 404 error
Cuvier’s Dwarf CaimanOP
@James4u it's 304 error, sorry, but i don't get more information
okay it's cached response, show me the code for your api route
@Cuvier’s Dwarf Caiman I feel like it's coming from the response inside try catch
Cuvier’s Dwarf CaimanOP
@James4u
yeah so @Cuvier’s Dwarf Caiman your response 304 is coming from catch clause
btw as I see the error message you get is not that helpful
"name" : "Error"
is chromium, browser from library or your custom util obj?
Cuvier’s Dwarf CaimanOP
Hi, @James4u, chromium is from playwright, a library for scraping
I know playwright - I used it for e2e testing
well, I can't imagine what's wrong there - you maybe need to check which line of your code is failing in your production
did you try npm run build & npm run start to run your local production?
does it work?
@James4u does it work?
Cuvier’s Dwarf CaimanOP
I ran npm run build and npm run start and the project starts without problem. Endpoints respond well
@Cuvier’s Dwarf Caiman How long does it take to scrap the website?
@Cuvier’s Dwarf Caiman <@970430299014041630>
to see which line throws an error, you need to can try to divide those code block into smaller ones wrapped by try catch and return different error message to see which one is actually causing the error