tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
287 stars 37 forks source link

Non explicit LibsqlError: SERVER_ERROR: Server returned HTTP status 400 #202

Open believelody opened 7 months ago

believelody commented 7 months ago

Hi guys, I'm following this tutorial about multi-tenant app with RemixJS + Drizzle + Turso. In short, when creating a tenant (called organization), a new database is created specifically for this tenant. So, I'm facing some issues with libsql. Even by cloning original repo (from the tutorial), doing await db.query or await db.select or await db.insert broke the app with this error: "LibsqlError: SERVER_ERROR: Server returned HTTP status 400". Seems like it happened when my app try to execute some queries for the specific database organization. I try to understand what cause this problem.

Dependencies version: "@libsql/client": "^0.3.6", "drizzle-orm": "^0.28.6", "drizzle-kit": "^0.19.13",

Check the following screenshot showing the error:

Screenshot 2024-04-12 at 03 25 31

This is the screenshot of the concerned file, line 48 is the problem:

Screenshot 2024-04-12 at 04 15 26
PedroAVJ commented 2 months ago

Hey did you figure out a solution? I am getting the same error on drizzle-kit push

MoaathAlattas commented 2 months ago

Hey did you figure out a solution? I am getting the same error on drizzle-kit push

Add driver: "turso" in your config file and make sure all env variables are set correctly and loaded when running commands.

https://orm.drizzle.team/learn/tutorials/drizzle-with-turso#:~:text=Setup%20Drizzle%20config%20file