net::ERR_NAME_NOT_RESOLVED Drizzle ORM

Hi, I have the following server component:
import { db } from "app/lib/db/index";
import { subjects } from "app/lib/db/schema"

export const runtime = 'edge'

export default async function Home() {
const users = await db.select().from(subjects)

return (
<>
<p>my users:</p>
{users.map((user) => (
<div key={user.id}>{user.name}</div>
))}
</>
)
}
import { db } from "app/lib/db/index";
import { subjects } from "app/lib/db/schema"

export const runtime = 'edge'

export default async function Home() {
const users = await db.select().from(subjects)

return (
<>
<p>my users:</p>
{users.map((user) => (
<div key={user.id}>{user.name}</div>
))}
</>
)
}
and when I try view this I get thousands of console errors of just the same thing:
// index.js:115 POST https://undefined/psdb.v1alpha1.Database/Execute net::ERR_NAME_NOT_RESOLVED
// index.js:115 POST https://undefined/psdb.v1alpha1.Database/Execute net::ERR_NAME_NOT_RESOLVED
I'm pretty sure this has to do with my database URL My db/index looks like this:
import { drizzle } from "drizzle-orm/planetscale-serverless";
import { connect } from "@planetscale/database";

// create the connection
const connection = connect({
host: process.env.DATABASE_URL,
});

export const db = drizzle(connection);
import { drizzle } from "drizzle-orm/planetscale-serverless";
import { connect } from "@planetscale/database";

// create the connection
const connection = connect({
host: process.env.DATABASE_URL,
});

export const db = drizzle(connection);
and my drizzle.config.ts looks like this:
import type { Config } from "drizzle-kit";

export default {
schema: "./app/lib/db/schema.ts",
out: "./drizzle",
dbCredentials: {
connectionString: process.env.DATABASE_URL,
}
} satisfies Config;
import type { Config } from "drizzle-kit";

export default {
schema: "./app/lib/db/schema.ts",
out: "./drizzle",
dbCredentials: {
connectionString: process.env.DATABASE_URL,
}
} satisfies Config;
my .env looks like this:
DATABASE_URL='mysql:[email protected]/mydbname?ssl={"rejectUnauthorized":true}'
DATABASE_URL='mysql:[email protected]/mydbname?ssl={"rejectUnauthorized":true}'
with ?ssl={"rejectUnauthorized":true} coming from the docs. any idea on how to fix this?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server