Build Fails Due to Missing Database Connection #11148
Replies: 2 comments 9 replies
-
Any movement on this? |
Beta Was this translation helpful? Give feedback.
-
I also stumbled upon this when my build failed during docker build because of the missing database connection and dug a bit into the database packages. While this is something you could workaround by disabling the SSG (which is not a good workaround in my opinion), it is still concerning that my whole app would crash unrecoverably once the database becomes unreachable for whatever reason (in my use case, only a small portion of my site uses Payload and thus requires a database connection - but also if a bigger portion of my site relies on a database connection, I'd rather handle that error gracefully with a custom error page or similar). I opened a discussion in #13537 about changing the behaviour of the database packages so they don't exit the nodejs process on a database failure. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🐛 Issue: Build Fails Due to Missing Database Connection
Description
The website template of Payload fails to build unless a database connection is provided or a container is running. This contradicts the Payload migration docs, which state that the build process should not require a database connection. Quoted as
"Running them during build time may be impossible due to not having access to your database connection while building or similar reasoning."
Expected Behavior
The build should complete successfully without requiring an active database connection.
Current Behavior
npm run build
(or equivalent build command) fails unless a database is connected.Steps to Reproduce
npm run build
.Additional Context
This behavior is unexpected based on the documentation. If this is intentional, it should be explicitly mentioned in the docs. Otherwise, a fix is needed to allow builds to run without a database connection.
Beta Was this translation helpful? Give feedback.
All reactions