-
I'm using Slonik in a NextAuth app and I'm having troubles since import NextAuth, { NextAuthOptions } from "next-auth";
import GithubProvider from "next-auth/providers/github";
import SlonikAdapter from "nextauth-slonik/dist/adapter";
import { type DatabasePool, createPool } from "slonik";
const pool: DatabasePool = createPool( // ❌ Type 'Promise<DatabasePool>' is not assignable to type 'DatabasePool'.
"postgres://postgres:docker@localhost:5432"
);
export const auth: NextAuthOptions = {
adapter: SlonikAdapter(pool),
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID!,
clientSecret: process.env.GITHUB_SECRET!,
}),
],
};
export default NextAuth(auth); How would I create the pool synchronously so that I can also export it? |
Beta Was this translation helpful? Give feedback.
Answered by
gajus
Feb 2, 2023
Replies: 1 comment
-
There is no way in Slonik to create a connection pool synchronously. The reason for that is because initializing Slonik pool requires data from the database. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gajus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is no way in Slonik to create a connection pool synchronously. The reason for that is because initializing Slonik pool requires data from the database.