porsager / postgres

Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare
The Unlicense
7.39k stars 267 forks source link

TypeError: client.unsafe is not a function #768

Open mvolkmann opened 9 months ago

mvolkmann commented 9 months ago

This very simple demo of using Drizzle with PostgreSQL and Node gives me the error message in the title. Am I doing something wrong in this file? https://github.com/mvolkmann/drizzle-postgres-node/blob/main/src/db.mjs

Louis-Tian commented 8 months ago

The file you referenced does not have any reference to unsafe at all, so I can't tell how are you using it. But I would guess the problem is exactly as the "error message" is saying. "unsafe" is not a function. unsafe is a string template. You don't do unsafe(...) instead you do unsafe`...`.

mvolkmann commented 8 months ago

@Louis-Tian You are correct that my code does not attempt to use unsafe. That is happening somewhere in the library code.