You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getStaticProps() with fallback: true works only with target: "server" build, not work with serverless build. Also require next start to bootstrap the server.
getStaticProps() and fallback: true, require a server to work. And the generated static files store in the file system of the server. And I'm supposed to set a Nginx proxy to handle the requests to those static files.
user navigate between pages with <Link /> component also trigger getStaticProps() or getServerSideProps(), and the slow server response can potentially slow down the transition.
In my case. I want to deploy my project to a serverless service (I really love Now, but I can't due to some reasons). And my project contains about 4,000 static pages whose data source is changed once a week.
Firstly, I gave up on exporting the 4,000 pages in the build time which is a lot work.
Since getStaticProps() along with getSaticPaths() and fallout came out, I found that it only work with a custom server while I don't want to maintain one.
However getServerSideProps() works great with serverless build, I don't think it is performant that every request to the pages require a backend API call, since they are relatively static.
So, I'd like to have a feature that output a build function in the serverless build which act like the next start with ordinary server build. When a request incoming, it initially calls this build function to check the existence of the generated static file (through a configured location, in my case, it is a url of the cloud storage), generates the files if needs to.
I don't know if there are any misunderstandings above. Please correct me if there is anything wrong!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
getStaticProps()
withfallback: true
works only withtarget: "server"
build, not work with serverless build. Also requirenext start
to bootstrap the server.getStaticProps()
andfallback: true
, require a server to work. And the generated static files store in the file system of the server. And I'm supposed to set a Nginx proxy to handle the requests to those static files.<Link />
component also triggergetStaticProps()
orgetServerSideProps()
, and the slow server response can potentially slow down the transition.getStaticProps()
along withgetSaticPaths()
andfallout
came out, I found that it only work with a custom server while I don't want to maintain one.getServerSideProps()
works great with serverless build, I don't think it is performant that every request to the pages require a backend API call, since they are relatively static.build function
in the serverless build which act like thenext start
with ordinary server build. When a request incoming, it initially calls thisbuild function
to check the existence of the generated static file (through a configured location, in my case, it is a url of the cloud storage), generates the files if needs to.I don't know if there are any misunderstandings above. Please correct me if there is anything wrong!
Beta Was this translation helpful? Give feedback.
All reactions