Yes, it seems that for NextJS if I use getServerSideProps() I would need to pass in the postgres database url in build time. The build worked when I passed in the database url in the Dockerfile, so the issue has now moved to this post: