lucia-auth / lucia

Authentication, simple and clean
https://lucia-auth.com
MIT License
8.61k stars 448 forks source link

[Bug]: Cloudflare D1 issue on Lucia 1.0.1 #1420

Closed serrf0f closed 4 months ago

serrf0f commented 5 months ago

Package

​@lucia-auth/session-drizzle

Describe the bug

There seems to be an ongoing issue with Cloudflare D1 that impacts the Drizzle ORM behavior.
When joining two tables that have common attributes names, the select will be wrong.
https://github.com/drizzle-team/drizzle-orm/issues/555

serrf0f commented 5 months ago

Here is the regression introduced by 1.0.1: https://github.com/lucia-auth/lucia/blob/5c366f5145aaf944362e49058edf7b413d1e7d35/packages/adapter-drizzle/src/drivers/sqlite.ts#L38

pilcrowOnPaper commented 5 months ago

I believe this has been fixed yesterday, assuming it was an issue with D1

https://github.com/cloudflare/workers-sdk/issues/3160#issuecomment-1943795347

pilcrowOnPaper commented 4 months ago

Gonna close this for now. Please open a new issue if the issue persists.

kossnocorp commented 1 month ago

Update: my fix landed with wrangler@3.57.2, and I can confirm that the problem is finally gone.

I noticed that there's a workaround for this case: https://github.com/lucia-auth/lucia/blob/main/packages/adapter-drizzle/src/drivers/sqlite.ts#L38-L42

@pilcrowOnPaper, I think you can remove it to improve the query performance.