Skip to content
Discussion options

You must be logged in to vote

When you build a Next.js application, actual HTML is generated, so at build time, the build step runs functions such as getStaticProps, to pre-render pages, it also tries to figure out which pages can be build already, and does it. It is an optimisation that's welcomed.

If you don't want that to happen, use getServerSideProps on the page that's trying to collect build time data, and then you should be fine. However, at run time, DATABASE_URL and all things necessary to render that page, better be present!

This is actually a good thing Next.js does with getStaticProps, it sort of type checks and makes sure things are in place do that it can work well in production. getServerSideProps runs …

Replies: 21 comments 109 replies

Comment options

You must be logged in to vote
2 replies
@neongreen
Comment options

@Ren-Logronio
Comment options

Comment options

You must be logged in to vote
9 replies
@neongreen
Comment options

@icyJoseph
Comment options

@neongreen
Comment options

@ovidiuc
Comment options

@neongreen
Comment options

Answer selected by leerob
Comment options

You must be logged in to vote
9 replies
@FrancescoSaverioZuppichini
Comment options

@paralin
Comment options

@marcusstenbeck
Comment options

@fredrikburmester
Comment options

@alexey-sh
Comment options

Comment options

You must be logged in to vote
11 replies
@icyJoseph
Comment options

@neongreen
Comment options

@neongreen
Comment options

@tim-trewartha
Comment options

@neongreen
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@shredding
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@rtritto
Comment options

@01febAkanshaMittal
Comment options

@rtritto
Comment options

@ianfebi01
Comment options

@icyJoseph
Comment options

Comment options

You must be logged in to vote
4 replies
@FESTUSNIX
Comment options

@prashantchothani
Comment options

@johncalvinroberts
Comment options

@prashantchothani
Comment options

Comment options

You must be logged in to vote
8 replies
@mengxi-ream
Comment options

@trautonen
Comment options

@trautonen
Comment options

@mengxi-ream
Comment options

@trautonen
Comment options

Comment options

You must be logged in to vote
4 replies
@noahgsolomon
Comment options

@noahgsolomon
Comment options

@nick-kang
Comment options

@Abukodonosor
Comment options

Comment options

You must be logged in to vote
2 replies
@trautonen
Comment options

@flodev
Comment options

Comment options

You must be logged in to vote
8 replies
@trautonen
Comment options

@is-it-ayush
Comment options

@icyJoseph
Comment options

@icyJoseph
Comment options

@is-it-ayush
Comment options

Comment options

You must be logged in to vote
2 replies
@icyJoseph
Comment options

@iyxan23
Comment options

Comment options

You must be logged in to vote
1 reply
@fredrikburmester
Comment options

Comment options

You must be logged in to vote
1 reply
@Abukodonosor
Comment options

Comment options

You must be logged in to vote
31 replies
@icyJoseph
Comment options

@fredrikburmester
Comment options

@fredrikburmester
Comment options

@icyJoseph
Comment options

@Abukodonosor
Comment options

Comment options

You must be logged in to vote
6 replies
@alexey-sh
Comment options

@nemanjam
Comment options

@icyJoseph
Comment options

@nemanjam
Comment options

@Abukodonosor
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet