Bozic0909
Bozic0909
Explore posts from servers
DTDrizzle Team
Created by Bozic0909 on 9/17/2023 in #help
connection ECONNREFUSED when trying to push to neon db
Hi people, I'm trying to connect my next.js app with drizzle to neon db, but I'm getting this error when i run push:pg
Error: connect ECONNREFUSED 127.0.0.1:5432
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at __node_internal_exceptionWithHostPort (node:internal/errors:642:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}
Error: connect ECONNREFUSED 127.0.0.1:5432
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at __node_internal_exceptionWithHostPort (node:internal/errors:642:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}
my config looks like this:
//drizzle.config.ts
import type { Config } from "drizzle-kit";

export default {
schema: "./src/server/db/schema.ts",
out: "./drizzle",
driver: "pg",
dbCredentials: {
connectionString: process.env.DATABASE_URL || "",
},
} satisfies Config;
//drizzle.config.ts
import type { Config } from "drizzle-kit";

export default {
schema: "./src/server/db/schema.ts",
out: "./drizzle",
driver: "pg",
dbCredentials: {
connectionString: process.env.DATABASE_URL || "",
},
} satisfies Config;
my db.ts file looks like this:
import { drizzle, PostgresJsDatabase } from "drizzle-orm/postgres-js";
import { migrate } from "drizzle-orm/postgres-js/migrator";
import postgres from "postgres";

// for migrations
const migrationClient = postgres(process.env.DATABASE_URL || "", { max: 1 });
migrate(drizzle(migrationClient), {
migrationsFolder: "./migrations",
});

// for query purposes
const queryClient = postgres(process.env.DATABASE_URL || "");
const db: PostgresJsDatabase = drizzle(queryClient);

export { db };
import { drizzle, PostgresJsDatabase } from "drizzle-orm/postgres-js";
import { migrate } from "drizzle-orm/postgres-js/migrator";
import postgres from "postgres";

// for migrations
const migrationClient = postgres(process.env.DATABASE_URL || "", { max: 1 });
migrate(drizzle(migrationClient), {
migrationsFolder: "./migrations",
});

// for query purposes
const queryClient = postgres(process.env.DATABASE_URL || "");
const db: PostgresJsDatabase = drizzle(queryClient);

export { db };
3 replies
DTDrizzle Team
Created by Bozic0909 on 8/28/2023 in #help
drizzle studio tables are empty
No description
4 replies