Closed geromii closed 1 month ago
@geromii Thank you for reporting the issue and thank you for taking the time to share all the insight.
I think this GitHub issue https://github.com/drizzle-team/drizzle-orm/issues/680 should give the insight you need.
I'll use your solution to fix the issue. The fix will be integrate into this PR: https://github.com/ixartz/Next-js-Boilerplate/pull/290
Just merged the PR: https://github.com/ixartz/Next-js-Boilerplate/pull/290 and it should the issue.
Thank you so much for reporting the issue.
Totally open to feedback and suggestion.
I added a Supabase database to the project, which successfully connected and ran the migration after running
npm run build
andnpm run start
on my machine. CRUD operations were all successful when accessing the guestbook through localhost:3000.Deployments to Vercel always succeeded. However, when accessing the Guestbook page on the Vercel production URL, the page would consistently generate an internal server error. The logs indicated the following error:
This error was triggered by the following line in
DB.ts
:await migratePg(drizzle, { migrationsFolder: './migrations' });
After confirming that the files were in the correct spot, I added a console log statement to check the path immediately before the migration:
This alone, without any change to the rest of the codebase, was sufficient in fixing the bug. I have no understanding of why this could have resolved it, but it did.
I then changed the code to:
And this seems to work reliably.
I would greatly appreciate any insights regarding why this issue occurs. Thank you for your time and for maintaining this excellent boilerplate.