Comments (7)
Thanks for the bug report @ahanusek @0x6c23 β this should've been fixed with vercel/next.js#38306, you'll just need to make a redeploy :)
from platforms.
Same happens when manually putting the bypassToken into x-prerender-revalidate
and calling the endpoints.
When I call /_sites/blog/id
I get a cache header of REVALIDATED
but the same problem persists, when deployed on vercel the site initially loads the new version but than reverts to the old one.
When I call /id
I get cache header HIT
and nothing happens.
EDIT:
Sometimes it seems to work. But it's very random. I just had a phase of like 20-30 minutes where it worked everytime (during the editing of the block). Now it stopped working altogether again. Nothing changed on my end
from platforms.
@steven-tey Thanks, now the path is proper and page is revalidated, but there is another issue in Next.js =>
So now, page is revalidated, I see that rendered HTML has refreshed data, but after that endpoint with .json data (https://subdomain.domian.pl/_next/data/build_number/pl/p/dynamic_page_name.json) return stale data from cache and overwrite view (maybe is somehow connected with next-i18next locales).
from platforms.
@steven-tey Thanks, now the path is proper and page is revalidated, but there is another issue in Next.js =>
So now, page is revalidated, I see that rendered HTML has refreshed data, but after that endpoint with .json data (https://subdomain.domian.pl/_next/data/build_number/pl/p/dynamic_page_name.json) return stale data from cache and overwrite view (maybe is somehow connected with next-i18next locales).
Exactly the same issue I'm having, which I also described while creating this issue. Pages get revalidated but when opening them they get overwritten by the old version after a split second. Not using locales.
It's not only when using <Link>
, it also happens when visiting the site directly.
from platforms.
Yep, works for me. Thanks.
from platforms.
Have similar issues when trying to revalidate page for subdomain. I'm just sending request to URL below:
https://subdomain.domain.pl/api/revalidate?secret=token&page=pagePath
api/revalidate.ts
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
// Check for secret to confirm this is a valid request
if (req.query.secret !== process.env.REVALIDATE_API_TOKEN) {
return res.status(401).json({ message: 'Invalid token' });
}
const path = String(req.query.page);
// eslint-disable-next-line no-console
console.log(`Revalidating page: ${path} for host ${req.headers.host}`, { header: req.headers });
try {
// this should be the actual path not a rewritten path
// e.g. for "/blog/[slug]" this should be "/blog/post-1"
await res.revalidate(`/${path}`);
return res.json({ revalidated: true });
} catch (err) {
// If there was an error, Next.js will continue
// to show the last successfully generated page
// @ts-ignore
// eslint-disable-next-line no-console
console.log('Error when updating url', path, err?.message, err);
return res.status(500).send('Error revalidating');
}
}
And getting 404
Failed to revalidate /pagePath: Invalid response 404
But when I'm just copy this path and use together with the url https://subdomain.domain.pl, in browser it works perfectly fine, so page exists. My middleware.ts is the exactly same like in this repo. Any hint how to solve that issue?
from platforms.
Hey @0x6c23 @ahanusek! Apologies for this βΒ this is due to the fact that Middleware doesn't execute for on-demand ISR requests, which means you have to put the exact URL that you want revalidated.
In this case, that's /_sites/${siteId}/${slug}
and it has to be sent to the same hostname that you want revalidated.
I've updated the code for the revalidate()
function and the part where it's called to account for this.
from platforms.
Related Issues (20)
- Bug: Adding a custom domain with an initial misconfigured DNS config keeps staying in error mode forever
- request headers host unexpectedly changed
- Error when deploying Django App on Vercel
- How to load different UI configurations based on the tenant? HOT 4
- how to invalidate all a pages of a [domain] route
- Title and description fields within the post editor do not trigger the save function as expected, also infinite loop on editor page related to nav.tsx HOT 4
- How to get this to work with next-auth v5? HOT 3
- Support for internationalization HOT 3
- When accessing blog created on localhost, it returns 404 how do I solve this HOT 2
- Edge function Error : ERR_MODULE_NOT_FOUND on an installed module HOT 1
- Errors are not showing on login page because of redirects in middleware HOT 1
- minor: (invalid?) use of promises HOT 1
- Stuck on "add your root domain & wildcard domain." from guide HOT 3
- Bug: able to create sites with blank site name & description HOT 1
- Use custom domain for Preview Deployments
- can we use platforms without vercel HOT 2
- Adding custom domains without relying on subdomains
- Feature Request: "teams/orgs" support
- RFC: Revert all edge rendering back to Node.js
- Supporting tenant subdomain login
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from platforms.