ixartz / SaaS-Boilerplate

🚀🎉📚 SaaS Boilerplate built with Next.js + Tailwind CSS + Shadcn UI + TypeScript. ⚡️ Full-stack React application with Auth, Multi-tenancy, Roles & Permissions, i18n, Landing Page, DB, Logging, Testing
https://react-saas.com/
MIT License
4.03k stars 565 forks source link

CI action fails on db migration #16

Closed steve-jiang closed 5 months ago

steve-jiang commented 5 months ago

First of all, thank you so much for this boilerplate. It has been awesome for someone like me who isn't familiar with how to create a SaaS from the beginning. 🙏

I have been using the repo to learn and got the below error in actions for CI:

 saas-boilerplate@1.4.0 db:migrate
> dotenv -c -- tsx ./scripts/dbMigrate.ts

Migration started
Migration failed
LibsqlError: SERVER_ERROR: Server returned HTTP status 401

This might be dumb question but what is the intended behaviour for CI regarding the DB? In the .env file, it says Please use a working DATABASE_URL., are we suppose to use the real turso db here? Or should the value come from Github secrets?

My understanding is that if the DATABASE_URL is remote, then we'd also need to specify the DATABASE_AUTH_TOKEN and I assume this is what causes the 401 error.

Or, are we supposed to use local db for the CI but then what are the right places for the envs?

ixartz commented 5 months ago

Thank you for your comments.

By default, without any changes and configuration, the CI should pass.

It seems I need to update the comment, it should be irrelevant now. I'll update the comment next week.

Yes, if DATABASE_URL is not local, you need to specify DATABASE_AUTH_TOKEN.

Hope now it's clear.

steve-jiang commented 5 months ago

Thanks @ixartz 🙏