© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
2 replies
ibet

Drizzle & Postgres JS - "postgres is not a function"

I'm using NestJS v10.3.6

package-json:
"drizzle-orm": ^0.30.10,
"postgres": ^3.4.4,
"drizzle-orm": ^0.30.10,
"postgres": ^3.4.4,


2024-05-10 01:48:34 [Nest] 53  - 05/09/2024, 6:48:34 PM   ERROR [ExceptionsHandler] (0 , postgres_1.default) is not a function
2024-05-10 01:48:34 TypeError: (0 , postgres_1.default) is not a function
2024-05-10 01:48:34 [Nest] 53  - 05/09/2024, 6:48:34 PM   ERROR [ExceptionsHandler] (0 , postgres_1.default) is not a function
2024-05-10 01:48:34 TypeError: (0 , postgres_1.default) is not a function


import { Injectable } from '@nestjs/common'
import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from 'src/schema'

@Injectable()
export class UsersService {
  async getAll(): Promise<(typeof schema.users.$inferSelect)[]> {
    const client = postgres('postgres://root:root@postgres:5432/testing', { // <== Here's the problem
      ssl: false,
    })

    const db = drizzle(client, { schema })

    // queries
  }
}
import { Injectable } from '@nestjs/common'
import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from 'src/schema'

@Injectable()
export class UsersService {
  async getAll(): Promise<(typeof schema.users.$inferSelect)[]> {
    const client = postgres('postgres://root:root@postgres:5432/testing', { // <== Here's the problem
      ssl: false,
    })

    const db = drizzle(client, { schema })

    // queries
  }
}


here's what i found inside the
/dist
/dist
directory :
const common_1 = require("@nestjs/common");
const postgres_js_1 = require("drizzle-orm/postgres-js");
const postgres_1 = require("postgres");
const schema = require("../../schema");
let UsersService = class UsersService {
    async getAll() {
        const client = (0, postgres_1.default)('postgres://root:root@postgres:5432/testing', { // PROBLEM!!
            ssl: false,
        });
        const db = (0, postgres_js_1.drizzle)(client, { schema });
        const users = await db.select().from(schema.users);
        return users;
    }
};
const common_1 = require("@nestjs/common");
const postgres_js_1 = require("drizzle-orm/postgres-js");
const postgres_1 = require("postgres");
const schema = require("../../schema");
let UsersService = class UsersService {
    async getAll() {
        const client = (0, postgres_1.default)('postgres://root:root@postgres:5432/testing', { // PROBLEM!!
            ssl: false,
        });
        const db = (0, postgres_js_1.drizzle)(client, { schema });
        const users = await db.select().from(schema.users);
        return users;
    }
};
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Drizzle TypeError: X.UPDATE_RULE.toLowerCase is not a function
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle-kit Error: TypeError: obj.enumValues.reduce is not a function
Drizzle TeamDTDrizzle Team / help
2y ago
Using drizzle postgres with trpc in Next.js app
Drizzle TeamDTDrizzle Team / help
16mo ago
DRIZZLE + NEXTJS App router + Supabase Error postgres js timeout
Drizzle TeamDTDrizzle Team / help
2y ago