[GH-ISSUE #660] NeonDbError syntax error at or near "asc" (no order by field passed) #8365

Closed
opened 2026-04-13 03:26:07 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @benjamindell on GitHub (Nov 25, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/660

Describe the bug
I've migrated over from next-auth to better-auth but i'm hitting an issue. When i try and login, i get the error below:

ERROR NeonDbError syntax error at or near "asc"

If I output the DB log, it looks like the issue is caused by there being no order by field being passed to the SQL

I am using the Drizzle adapter. The only overrides i've had to do is set the modelName for each table as they were named differently in my DB.

QUERY
select "userId", "type", "provider", "providerAccountId", "refresh_token", "access_token", "expires_at", "token_type", "scope", "id_token", "session_state", "crea
tedAt", "updatedAt" from "Account" where "Account"."userId" = $1 order by asc limit $2
[ 'clw0gmvy50000j6kgi4vw9emu', 100 ]
END_QUERY

I've had a look through the source code but I cant seem to find where the sortBy field is passed. Does anyone have any clues?

Originally created by @benjamindell on GitHub (Nov 25, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/660 **Describe the bug** I've migrated over from next-auth to better-auth but i'm hitting an issue. When i try and login, i get the error below: ERROR NeonDbError syntax error at or near "asc" If I output the DB log, it looks like the issue is caused by there being no order by field being passed to the SQL I am using the Drizzle adapter. The only overrides i've had to do is set the modelName for each table as they were named differently in my DB. ___QUERY___ select "userId", "type", "provider", "providerAccountId", "refresh_token", "access_token", "expires_at", "token_type", "scope", "id_token", "session_state", "crea tedAt", "updatedAt" from "Account" where "Account"."userId" = $1 order by asc limit $2 [ 'clw0gmvy50000j6kgi4vw9emu', 100 ] ___END_QUERY___ I've had a look through the source code but I cant seem to find where the sortBy field is passed. Does anyone have any clues?
GiteaMirror added the locked label 2026-04-13 03:26:07 -05:00
Author
Owner

@Bekacru commented on GitHub (Nov 26, 2024):

could you confirm me, if this is still an issue on latest?

<!-- gh-comment-id:2499823452 --> @Bekacru commented on GitHub (Nov 26, 2024): could you confirm me, if this is still an issue on latest?
Author
Owner

@benjamindell commented on GitHub (Nov 26, 2024):

Amazing! Thanks for the quick reply. I've just updated the package to the latest version and that seems to have fixed it.

Thanks.

<!-- gh-comment-id:2500027066 --> @benjamindell commented on GitHub (Nov 26, 2024): Amazing! Thanks for the quick reply. I've just updated the package to the latest version and that seems to have fixed it. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8365