-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routes using data fetching methods return 304 on non-conditional requests #56018
Comments
We encounter the same symptoms, reproducible on Unlike the OP, we do not use dynamic routes & generateStaticParams. Instead we just use const res = await fetch(endpoint, {
headers: { Authorization: `Bearer XYZ` },
next: {
revalidate: 60,
},
}); |
We ran into the same issue (13.5.1 with app folder on production and self-hosted with standalone build) were some of our static routes with As a workaround we resorted to using |
Updated reproduction repo with a static page. |
Same issue for me, can't upgrade from 13.4.12 |
We're facing a similar issue. We upgraded to version 13.5.3 to address memory leaks, but now we're encountering the 304 code and a white screen after revalidation. |
Same problem in production on 13.4.19 and 13.5.4. Getting 304, Not Modified and empty response bodies. Downgraded all the way to 13.4.12 until this is fixed. |
I face same issue after upgrading to 13.5.3 |
same issue with 13.5.4 |
This comment has been minimized.
This comment has been minimized.
We have a catch-all dynamic route export const dynamicParams = true;
export const revalidate = 10;
export async function generateMetadata(
{ params: { path } }: Props,
parent: ResolvingMetadata,
): Promise<Metadata> {
const { page = {} as Page } = await getPageContent({ path });
return {
title: page.title
};
}
export const generateStaticParams = async () => {
const pagePaths = await getPaths();
const paths = pagePaths.map((pagePath) => ({
path: pagePath.split('/'),
}));
return paths;
};
export default async function Page({
params: { path },
}: {
params: { path: PagePaths };
}) {
const { page } = await getData({ path });
return <>Page content goes here</>;
} Then we do a So, for all the statically generated pages we get a But, once you get a |
@syed-ahmad Our code looks very similar and we encountered the same issue. when we built our docker image and ran it locally we could even reproduce the error. We just had to leave it running a bit (presumably when next.js cache revalidates) and eventually we got back blank pages with For now we have removed generateStaticParams from our dynamic route. |
same issue when upgrade to 13.5.X ... |
Same issue here. Self-hosted website with app router. I'm stuck on version |
npm run build can help in my experience, rather than using yarn run build. |
I am using pnpm here ! |
Same here. We are trying a new NextJs version each time it release and it's broken each time. Still using 13.4.19. |
We use 13.4.5, and it's also works fine |
We have the same problem for all |
We encountered this issue as well on a self hosted NextJs project. Switching back to |
It's still present in 13.5.6 standalone production mode. reverted to 13.4.19 |
Hi @balazsorban44 I saw you closed a related issue and I was just wondering if Next has their eye on this one I didnt see any members in the comments so hoping its on the radar |
I have the same problem, and my project is facing issues and has come to a complete halt. |
Does not work for me :/ Anyone else? |
Same situation. In standalone prod mode sometimes heppens 304, nextjs 13.5.6. Now I want rto try with 14.0.2 |
After 12 hours on prod same error with 304 response on version 14.0.3 =( |
I'm testing on v14.0.2 and currently it's running without issues in production. I will keep an eye on it. Maybe the issue comes up in the next days again... |
I had the same problem initially, with 14.0.2 (running standalone on azure web app - node 20 lts). I had to remove the old node_modules folder in the azure resource for it to work. I haven't figured out how to replace old files/folders in the azure resource automatically instead of just patching existing. When removing them manually and deploying again it seems to be working. Has been up since Friday afternoon. Crossing my fingers that it will keep on working... |
@paataD does it happen even after you remove |
Sorry, it's work perfect on 14.0.*, thank you! |
Related #58646 |
Yes, upgrading to the latest versions worked. |
Seems also to work on my website running on Next.js 14.0.2 |
Upgrading to latest version doesnt works for me, on production it still sends empty responce with 304 status. |
Ran into this issue on a production site running 13.5.4. Can anyone verify is the issue is fixed on a version > 13.5.4? Or 14? There are notes of the issue still being present there. #57737 |
the issue is also in v14.0.1 only in production mode |
We are also suffering from this. The site responds fine for some users, but some are unable to open it at all. |
|
hi @dmitriigirskii what version did you use? And is it really fixed this issue? Thanks |
@smuk3c says it's still in 14.0.4 and that is as far as I can tell, the most recent version. So, it appears that it's not certain that it's fixed. |
Upgraded my project to 14.0.4 last week, and both issue of |
have problem in 13.5.5. |
@kevineinarsson Can you confirm if you are still experiencing |
We have the same issue with dynamic routes; right now we are on |
Happened to me on 14.0.1 but seems to be fixed by upgrading to 14.0.4 Will update if it occurs again 👀 |
Same here on 14.0.1, updated to 14.0.4 and it worked again! |
We're having this issue still on 14.1.0 |
Since we are no longer getting this issue on the latest version, I will proceed with closing this issue! If this issue arises again, please feel free to submit a new bug report so we can take a look! |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/kevineinarsson/next-revalidate-issue
To Reproduce
Start the application in production mode (build & start)
Curl one of the routes:
These should return 200:s, no matter how many times you curl. Note the x-nextjs-cache header which indicates whether a revalidation of the content is performed (due to fetch options including
next: { revalidate: 5 }
)This should return a 304, since we're matching against an ETag and the content matches.
However, if a revalidation occurs from a request that includes a If-None-Match header, the
.meta
will now containstatus: 304
, causing subsequent requests without an ETag to return 304 not modified, which should not happen.Current vs. Expected behavior
Cache updates should not store conditional headers such as 304. The result of the operations above should be a 200 in the metadata file.
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023 Binaries: Node: 20.6.1 npm: 10.1.0 Yarn: 1.22.19 pnpm: 8.7.5 Relevant Packages: next: 13.5.4 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
Issue does not appear on 13.4.17.
In dynamic routes, removing
generateStaticParams()
makes the problem disappear, but doing so leads to a response without an ETag.Using
export const dynamic = 'force-dynamic';
works for static pages, but of course makes them dynamic.NEXT-1699
The text was updated successfully, but these errors were encountered: