Need Help with Astro + Cloudflare + Turso DB Setup
Hey everyone, I’m running into an issue with my Astro app. Locally, everything works fine, but in production on Cloudflare, I’m getting a 401 Unauthorized error when trying to insert data into the database (db.insert(Waitlist_signups)). I’m using Turso for the database as per the documentation and have added the necessary environment variables (both the DB token and URL) in Cloudflare, but still facing this issue.
Has anyone encountered something similar or know what could be causing the 401 error?
Thanks in advance for any help!
3 Replies
Is it correct to set db app token and db app url in the env vars?
yep, I'd make sure your env vars are set correctly - log them out and see if they return what you expect
If so, I'm not too sure - I haven't used this. May be worth asking in the Astro server - https://astro.build/chat
Discord
Join the Astro Lounge Discord Server!
The official community server for the Astro framework. Learn more at https://astro.build | 31464 members
Nothing has worked so far. I think it is just astro dbs ability to connect to remote db functionality is not supported on non-nodejs environments like cloudflare and deno. There is a note in the docs about that but I am not sure if I understand that correct