-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
GetStaticProps returning initial notFound never triggers a rebuild on revalidate with dynamic routes #21453
Comments
I actually observe the opposite behavior, here is a sandbox: You might need to fork and restart the sandbox to see it, it runs If I return I'm wondering however if that behavior of **Edit: ** Created a separate issue here: #21809 |
Thanks for the sandbox @janus-reith, I actually forgot to mention that this happens with dynamic routes, I think how static routes work like in your Sandbox should be the way to go. I made a fork of your sandbox here with dynamic routes. Notice that the |
I am encountering a similar experience (but somewhat in reverse). The initial static page with a dynamic route is built successfully. I confirmed that the data fetching call that should happen in |
Same here, when |
Any update on this? Also experiencing this and especially with dynamic routes being controlled by a client it's impossible to manually keep track of all the routes that change from/to 404.. |
Same here, when a page is 404 it never gets rebuilt. |
We're experiencing this problem as well. It's a pretty big issue for us if products are being added to our product catalog that had been a 404 before but won't revalidate. Would appreciate an update as well. (next v11.0.1) |
@tbgse is |
hi @ijjk we're setting Our page generation logic is fairly complex, but below a small excerpt where we'd basically return a page with props from I will try to create a small repo to reproduce this. const makeResult = async (pageName: string, specifics: PageSpecificProps) => ({
props: {
footer,
locale,
menuNavigation,
messages,
pageName,
params: props.params,
path,
webStore,
...specifics
},
revalidate: 300
});
const entryType = result.entry?.sys.contentType.sys.id;
if (entryType === 'Collection') {
const collectionPage = result.entry;
const collection = await retrieveCollectionPageData(collectionPage, locale, webStore);
return makeResult('collection', {
collection,
type: 'collection',
urlRoute: result.urlRoute
});
} else {
return { notFound: true, revalidate: 300 };
} |
@ijjk I just created a repo here: https://github.com/tbgse/next-no-revalidate But it seems like in this scenario everything is working as expected. I tried revalidating both for routes with and without fallback and it seems like they recover nicely from it (see here https://next-no-revalidate-okhtkqp1j-tbgse.vercel.app/revalidate), you'd have to refresh a couple of times until you get the right number. But everything works as expected. Maybe something else was at play, our EDIT: I think i found what our problem is. We use a custom 404 page and this page also uses |
I created an other reproduction here: https://github.com/la55u/revalidate-test
The important part is that steps 2 & 4 should happen at a time when the minute is even e.g. 11:32, so the notFound will return |
@la55u I tried testing out your reproduction and tweaked it a bit to make triggering the notFound easier but it doesn't seem to behave incorrectly, see below screen recording: Screen.Recording.2021-08-11.at.10.05.22.AM.mov |
@ijjk keep in mind that the original issue only happens with dynamic routes |
@alizeait just double checked dynamic routes and it seems to be working correctly as well Screen.Recording.2021-08-11.at.10.21.26.AM.mov.recording.mov.mov |
@ijjk You did not satisfy the condition of the bug because when you ran |
Can confirm for 11.0.1, but looks like it got resolved from 11.1.0 11.0.1nextjsDoesntWork.mov11.1.0nextjsdoeswork.mov |
Update: just got the same issue with the current version 11.1.0 |
This fixes revalidation not occurring correctly when `notFound: true` is returned during build, additional tests have been added to ensure this is working correctly for dynamic and non-dynamic pages returning `notFound: true` during build and then revalidating afterwards. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Errors have helpful link attached, see `contributing.md` Fixes: #21453
Hi, this should be updated in the latest version of Next.js |
Still reproduce with revalidate: 60, fallback: "blocking" in next 11.1.2 |
My mistake. Didn't added revalidate to return with notFound |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.0.5
What version of Node.js are you using?
12.13.0
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next start
Describe the Bug
If
getStaticProps
returnsnotFound: true
in the initial build with a revalidate value, Nextjs never tries to rebuild the pageExpected Behavior
Nextjs should try rebuilding the page instead of assuming permanent 404
To Reproduce
The text was updated successfully, but these errors were encountered: