Dhravya / cloudflare-saas-stack

Quickly make and deploy full-stack apps with database, auth, styling, storage etc. figured out for you. Add all primitives you want.
3.07k stars 231 forks source link

Error after first deploy #8

Closed abaudhuin closed 3 months ago

abaudhuin commented 3 months ago

image

After a first deploy i still get an error. I'm not too familiar with this env so I'm not sure where to check.

Everything logs ok in real time logs too:

image

Any idea why ?

DiogoDuart3 commented 3 months ago

Same here, must be something to do with the wrangler file that sets up the database

Dhravya commented 3 months ago

Yeah! I think this is because the remote database migrations aren't there i guess? I'm looking into it. Thanks for letting me know

DiogoDuart3 commented 3 months ago

Nah, by following the readme it will run the migrations on the cloudflare database and it works locally, its the cloudflare deployment that didnt read that file i guess

DiogoDuart3 commented 3 months ago

The latest version of drizzle orm removed the driver "d1" and now has "d1-http"

Dhravya commented 3 months ago

Right, makes sense :)

there's a PR by @codetorso which i'll merge soon but that's the steps to fix it!

abaudhuin commented 3 months ago

Great. Feels kinda weird that there is no error anywhere though

DiogoDuart3 commented 3 months ago

This is the error from the cloudflare functions image

Dhravya commented 3 months ago

When you run it locally, the database used is actually a local sqlite instance. When deployed, it uses a remote version of the same database.

cd apps/web && wrangler d1 execute ${YOUR-DATABASE-NAME} --file=migrations/0000_setup.sql --remote

Dhravya commented 3 months ago

I fixed this issue in the setup script

DiogoDuart3 commented 3 months ago

Running "bunx wrangler d1 migrations apply DB_NAME --remote" worked

Dhravya commented 3 months ago

Perfect!

Dhravya commented 3 months ago

@abaudhuin can you confirm this too?

abaudhuin commented 3 months ago

yes, I confirm it's deployed now! Thanks