Using cloudflare pages postgres and lucia

Hey all im running into so many issues trying to get this setup, has anyone done this before, i have tried to use createClient, sql and createPool from @vercel/postgres but i cant get it working, does anyone have an example of how do this? i want to use a direct connection to my postgres db
1 Reply
sanser
sanserOP14mo ago
import { pg as PostgresAdapter } from '@lucia-auth/adapter-postgresql';
import * as schema from '$lib/db/schema';

import { createPool } from '@vercel/postgres';
import { drizzle } from 'drizzle-orm/vercel-postgres';

const sqlClient = createPool({ connectionString: DATABASE_URL });

const db = drizzle(sqlClient, { schema });

export const auth = lucia({
adapter: PostgresAdapter(sqlClient, {
user: 'auth_user',
key: 'user_key',
session: 'user_session'
}),
import { pg as PostgresAdapter } from '@lucia-auth/adapter-postgresql';
import * as schema from '$lib/db/schema';

import { createPool } from '@vercel/postgres';
import { drizzle } from 'drizzle-orm/vercel-postgres';

const sqlClient = createPool({ connectionString: DATABASE_URL });

const db = drizzle(sqlClient, { schema });

export const auth = lucia({
adapter: PostgresAdapter(sqlClient, {
user: 'auth_user',
key: 'user_key',
session: 'user_session'
}),
my database is neon but i will use move this to AWS once testing is complete then if i use import {sql} from '@vercel/postgres' it builds!!!! but then i get ReferenceError: process is not defined error when hitting my endpoints which interact with the database
Want results from more Discord servers?
Add your server