Closed a-salimkhanov closed 3 years ago
You're using fallback: true
, so this is expected behavior on the first request. Please check the fallback documentation: https://nextjs.org/docs/basic-features/data-fetching#fallback-true
You'll likely want to use fallback: 'blocking'
: https://nextjs.org/docs/basic-features/data-fetching#fallback-blocking
Thanks a lot @timneutkens. Works like a charm )
P.S. I don't know how come I hadn't seen fallback: 'blocking'
option in the documentation
Solved also my issue, but then I don't understand nextjs:
So to reproduce: Disable javascript, set fallback to true and request an URL that is not defined in paths: I still expect getStaticProps to be run, but it's not. But getStaticProps is run when javascript enabled, why is it not run for fallbacks?
@timneutkens ?
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.1.4-canary.18
What version of Node.js are you using?
10.19.0
What browser are you using?
Chrome
What operating system are you using?
Ubuntu
How are you deploying your application?
next start
Describe the Bug
When a page with
getStaticProps
is requested within command line (not browser), it is not generated and returns a page with undefined data in it ifgetStaticPaths
is like:Expected Behavior
It should generate the requested page as it does in browser
To Reproduce
Create a page with
getStaticProps
something like...Grab meta tags with websites like https://metatags.io/ . Or run in Python:
Or you can just use
curl "http://example.com/event/1"
in Linux TerminalYou won't see getStaticProps fired... message in npm logs. But if you load the page in browser, everything works fine.
And also if you use
getInitialProps
orgetServerSideProps
instead ofgetStaticProps
, everything works fine.