Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
@copilot its probably actually just a database connection issue. can we just do some general checks if the database connection is present and if its not cancel the entire deployment? |
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Changed the approach to fail the deployment when database connection is unavailable. The build will now exit with an error and display clear messages like: All in-memory fallback logic has been removed. If the database isn't properly configured, the deployment will be cancelled. (commit: f577a1e) Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
| updatedAt: Date; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
We don't need to change this
There was a problem hiding this comment.
Removed the DEFAULT_SETTINGS_VALUES constant and inlined the values. (commit: ce05fce)
| customMessage: null, | ||
| } as const; | ||
|
|
||
| /** |
There was a problem hiding this comment.
Let's get rid of all of these thorough comments
There was a problem hiding this comment.
Removed all verbose comments from the getSettings function. (commit: ce05fce)
| } catch (error) { | ||
| // Check if this is a database connection error | ||
| const isDatabaseConnectionError = | ||
| error instanceof PrismaClientInitializationError || |
There was a problem hiding this comment.
Check for any kind of database error on startup, not only in the settings. if there ever is a connection error we should immediately kill everything
There was a problem hiding this comment.
Created a global database connection check in lib/db.ts with a checkDatabaseConnection() function that's called at app startup via instrumentation.ts. This checks the database connection before any code runs, failing fast if the database is unavailable. (commit: ce05fce)
|
@copilot changes requested |
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Could you clarify what changes you'd like me to make? I've addressed the previous review comments:
What additional changes would you like? |
| @@ -0,0 +1,6 @@ | |||
| export async function register() { | |||
| if (process.env.NEXT_RUNTIME === 'nodejs') { | |||
There was a problem hiding this comment.
The runtime check prevents the app from running in different environments (Node.js vs Edge). However, we can achieve the same result by simply removing error handling from settings.ts and letting database errors propagate naturally. Would you prefer I remove instrumentation.ts and just let the build fail when getSettings() encounters a database error?
There was a problem hiding this comment.
Yeah lets remove the specific check and let them propogate naturally
There was a problem hiding this comment.
Removed instrumentation.ts and checkDatabaseConnection(). Database errors now propagate naturally from getSettings(), failing the build when database is unavailable. (commit: 00eccf9)
|
@copilot I'm getting an issue: Error occurred prerendering page "/not-found". Read more: https://nextjs.org/docs/messages/prerender-error |
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
This error is expected behavior - the build is correctly failing because the database connection is unavailable. The error message shows: This means your database credentials or connection string need to be updated. Once the database is properly configured and accessible, the build will succeed and settings will be created automatically if they don't exist. (commit: 00eccf9) |
|
@copilot I'm getting an error now that the DB connection is established: Error occurred prerendering page "/not-found". Read more: https://nextjs.org/docs/messages/prerender-error are the DB migrations out of sync? |
Yes, the database migrations are out of sync. The schema expects an npx prisma migrate deployOr if you're in development: npx prisma migrate devThe migration that adds this column is |
Application crashes on startup with
PrismaClientInitializationErrorwhen database is unavailable or settings table is empty. The application now fails the deployment immediately to prevent running with an improperly configured database.Changes
Settings Initialization
getSettings()to basic fetch/create logic without error handlingBefore:
After:
This ensures deployments only succeed when the database is properly configured and accessible. If the database connection fails, Prisma throws a
PrismaClientInitializationErrorwhich propagates up and fails the build with clear error messages:The build will exit with code 1, preventing deployment with an improperly configured database.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.