postgres npm package support #654

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

Originally created by @bobbymannino on GitHub (Feb 11, 2025).

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

I would like to use the Postgres package like so

import pg from 'postgres'

export const auth = betterAuth({
  database: pg,
});

but I cannot, it gives me the following error

ERROR [Better Auth]: NOT_TAGGED_CALL: Query not called as a tagged template literal

is there a work around? I have already laid all the app foundation with that package and do not want to switch to pg

Describe the solution you'd like

to implement functionality for the Postgres package

Describe alternatives you've considered

the pg package does work

Additional context

No response

Originally created by @bobbymannino on GitHub (Feb 11, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I would like to use the `Postgres` package like so ```typescript import pg from 'postgres' export const auth = betterAuth({ database: pg, }); ``` but I cannot, it gives me the following error ```shell ERROR [Better Auth]: NOT_TAGGED_CALL: Query not called as a tagged template literal ``` is there a work around? I have already laid all the app foundation with that package and do not want to switch to `pg` ### Describe the solution you'd like to implement functionality for the `Postgres` package ### Describe alternatives you've considered the `pg` package does work ### Additional context _No response_
Author
Owner

@Bekacru commented on GitHub (Feb 11, 2025):

You can use the kylsey dialect
https://github.com/kysely-org/kysely-postgres-js

export const auth = betterAuth({
    database: { 
        dialect: new PostgresJSDialect({
               postgres: postgres({
              database: 'test',
              host: 'localhost',
              max: 10,
              port: 5434,
              user: 'admin',
          })
      }),
      type: "postgres"
   }
})
@Bekacru commented on GitHub (Feb 11, 2025): You can use the kylsey dialect https://github.com/kysely-org/kysely-postgres-js ```ts export const auth = betterAuth({ database: { dialect: new PostgresJSDialect({ postgres: postgres({ database: 'test', host: 'localhost', max: 10, port: 5434, user: 'admin', }) }), type: "postgres" } }) ```
Author
Owner

@bobbymannino commented on GitHub (Feb 11, 2025):

thank you, got it working

@bobbymannino commented on GitHub (Feb 11, 2025): thank you, got it working
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#654