DT
Drizzle Team•14mo ago
Anand

Postgresjs with Neon giving connnection refusal error

I am unable to connect to my neon database. I tried using postgresjs and the neon serverless drivers. Still no luck 🙂
No description
5 Replies
Anand
AnandOP•14mo ago
index.ts this file contains the drizzle connection logic
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const PGUSER = decodeURIComponent(process.env.PGUSER || "");

const queryClient = postgres({
host: process.env.PGHOST || "",
user: PGUSER,
password: process.env.PGPASSWORD || "",
database: process.env.PGDATABASE || "",
port: 5432,
ssl: true,
});
const db = drizzle(queryClient);

export default db;
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const PGUSER = decodeURIComponent(process.env.PGUSER || "");

const queryClient = postgres({
host: process.env.PGHOST || "",
user: PGUSER,
password: process.env.PGPASSWORD || "",
database: process.env.PGDATABASE || "",
port: 5432,
ssl: true,
});
const db = drizzle(queryClient);

export default db;
drizzle.config.ts
import type { Config } from "drizzle-kit";

const PGUSER = decodeURIComponent(process.env.PGUSER || "");

export default {
schema: "./db/schema.ts",
out: "./drizzle",
driver: "pg",
dbCredentials: {
host: process.env.PGHOST || "",
user: PGUSER,
password: process.env.PGPASSWORD || "",
database: process.env.PGDATABASE || "",
port: 5432,
ssl: true,
},
} satisfies Config;
import type { Config } from "drizzle-kit";

const PGUSER = decodeURIComponent(process.env.PGUSER || "");

export default {
schema: "./db/schema.ts",
out: "./drizzle",
driver: "pg",
dbCredentials: {
host: process.env.PGHOST || "",
user: PGUSER,
password: process.env.PGPASSWORD || "",
database: process.env.PGDATABASE || "",
port: 5432,
ssl: true,
},
} satisfies Config;
Anand
AnandOP•14mo ago
project structure
No description
Anand
AnandOP•14mo ago
I am currently in the web app of my turborepo (the web app is a single nextjs app router app) I am able to generate SQL file, but not able to migrate or connect to it
Anand
AnandOP•14mo ago
No description
Anand
AnandOP•14mo ago
@Andrew Sherman
Want results from more Discord servers?
Add your server