Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError setting up client #877

Open
paulrenenichols opened this issue May 23, 2024 · 1 comment
Open

TypeError setting up client #877

paulrenenichols opened this issue May 23, 2024 · 1 comment

Comments

@paulrenenichols
Copy link

paulrenenichols commented May 23, 2024

Trying to use postgres with drizzle in a nestjs app. Getting this error when I run the server:

/Users/paulrenenichols/SoftDev/interviews/zello/admin-portal/services/server/src/database/db.ts:7 const client = postgres(dbUrl); ^ TypeError: (0 , postgres_1.default) is not a function at Object.<anonymous> (/Users/paulrenenichols/SoftDev/interviews/zello/admin-portal/services/server/src/database/db.ts:7:24) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Object.require$$0.Module._extensions..js (/Users/paulrenenichols/SoftDev/interviews/zello/admin-portal/.pnp.cjs:20941:33) at Module.load (node:internal/modules/cjs/loader:1208:32) at Function.Module._load (node:internal/modules/cjs/loader:1024:12) at Function.require$$0.Module._load (/Users/paulrenenichols/SoftDev/interviews/zello/admin-portal/.pnp.cjs:20789:31) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (/Users/paulrenenichols/SoftDev/interviews/zello/admin-portal/services/server/src/customer/customer.service.ts:2:1)

Here is the source code for that file:

import { drizzle } from 'drizzle-orm/postgres-js';
import * as schema from './schema';
import postgres from 'postgres';

const dbUrl = process.env.DATABASE_URL;

const client = postgres(dbUrl);
export const db = drizzle(client, { schema, logger: true });

I'm using Yarn 4 pnp to manage my packages.

@kam-st
Copy link

kam-st commented Jun 9, 2024

Type issues are coming from drizzle, please post this issue on drizzle repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants