-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Next 13 static page x-vercel-cache is always MISS instead of HIT #42112
Comments
To cache at CDN level you would need to set the Cache-control header (currently not possible) I think when the docs talk about cache they are referring the the fetch cache and not the page html cache |
I'm seeing this same thing at the moment with the new Payload CMS site that we're working on. Homepage cache is HIT but all our docs pages are MISS, no matter what we do. |
We have the same issue! |
Hi, this is due to |
Seems like enormous problem? We too have problem with out static site that is built on DatoCMS. So now, we have SSR on every hit instead of serving static webpages with ISR, as it was with Next12. |
I am also facing similar issue. NextJS13 page returns cached data with |
same here! i'm using Middleware |
This seems to be fixed in Next 13.1 |
I have the same issue with [13.3.1-canary.17] |
Same issue with |
This is still a massive issue. Ive lost the cache-control header control on my side. @ijjk im assuming its related to this |
I'm facing the same issue |
I was able to find a work around. in my case disabling Apollo Cache (not be optimal) return new ApolloClient({
link: ApolloLink.from([
....//
]),
cache: new InMemoryCache(), // just deleting this is was giving me an error
defaultOptions: {
query: {
fetchPolicy: "no-cache",
},
},
}); |
cache-control headers can be controlled through but its not supported through the |
Steven from Vercel here – I just made a minimal repro that confirms this – it looks like it's a bug that's caused when you use Will work with the team to fix this! 🙏 |
@steven-tey is there any chance this issue is related?: #50914 (comment) |
Closed this issue by accident, sorry about that! Re-opening 😅 |
Please verify that your issue can be recreated with Why was this issue marked with the
|
It would be helpful to verify this is still an issue on |
for anyone else struggling with this, this currently works for dynamic ie // Force static pages
export const dynamic = "force-static";
// CDN cache currently only works on nodejs runtime
export const runtime = "nodejs";
// Revalidate in seconds
export const revalidate = 60;
// If you want to pregenerate routes/pages at build time
// export async function generateStaticParams() {
// return (await getPostSlugs()).map((slug) => ({ slug: slug }));
// }
interface PageProps {
params: { slug: string };
}
export default async function Page({ params }: PageProps) {
const data = await getPost(params.slug);
return <div>{JSON.stringify({data})}</div>;
} |
This issue has been automatically closed because it wasn't verified against next@canary. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you. |
Fresh minimal repro on https://github.com/samburgers/vercel-edge-test Deployed: Confirming the behaviour still appears to be: Cache MISS export const runtime = "edge";
export const dynamic = "force-static"; Cache HIT export const runtime = "nodejs";
export const dynamic = "force-static"; Cache HIT // default runtime is currently nodejs
export const dynamic = "force-static"; Definitely agree that static pages wouldn't benefit much from edge runtime, but folks that are chasing page performance may easily arrive at the first configuration, and have a difficult time understanding why the CDN cache isn't working at all. Possibly throwing a warning somewhere might help even (or some addition to the docs). Thanks again! |
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. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
I moved my
pages/index.tsx
static page toapp/page.tsx
. The page is completely static and I was hoping to cache the page in the edge. I tried Segment config witherror
but the pages don't seem to be cached from the edge. If it helps, I also set the same segment config inapp/layout.tsx
.The cache headers always come back as MISS.
x-vercel-cache: MISS
Unrelated: I'm also curious if there is a way to debug Vercel edge caching in local when using Next.js. It's a pain to deploy to vercel every time to check if it's working or not.
Expected Behavior
The cache headers always come back as HIT for the static page.
x-vercel-cache: HIT
.Link to reproduction
https://github.com/flexdinesh/next13-edge-cache-bug
To Reproduce
I have deployed the bug repo here: https://next13-edge-cache-bug.vercel.app
Inspect the page in dev tools network tab and you'll see that the cache hit is always MISS.
Or follow these steps.
appDir
in next config.app/page.tsx
andapp/layout.tsx
with boilerplate code.dynamic
aserror
.When you inspect the page in browser developer tools,
x-vercel-cache
will beMISS
but it should beHIT
after the first load.The text was updated successfully, but these errors were encountered: