GET API executing during build time but not in the run time #68357
Unanswered
jyoti-r-4
asked this question in
App Router
Replies: 2 comments 8 replies
-
|
There's something called, automatic cache optimization. This is rather controversial, so much so that, Next 15, will drop it. You can just add a
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks Joseph. As you said, I've added |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm woking on Next.js 14.2.3. I'm writting my API inside
app/api/v1/variable/abc/route.ts. I've written a GET() like below:During build time, it's printing the log which is
response.datain my code. But when the code is running during production i.e.npm start, it's not giving me updated data from the database. But it's giving the data which was present during the build time.But if I'll change the method to POST, it's working fine as expected.
I've written other GET() in the same way but those are not considered as static, but this one only considered as static. Why?
Is there any issue with the GET method? Can someone help here?
This screenshot is for your reference:

Beta Was this translation helpful? Give feedback.
All reactions