HRANA_WEBSOCKET_ERROR: Unexpected server response: 404

// ./drizzle.config.ts
import type { Config } from "drizzle-kit";

export default {
schema: "./src/db/schema.ts",
out: "./drizzle",
driver: "turso",

dbCredentials: {
authToken: Bun.env.DATABASE_AUTH_TOKEN,
url: Bun.env.DATABASE_URL!,
},

verbose: true,
strict: true,
} satisfies Config;
// ./drizzle.config.ts
import type { Config } from "drizzle-kit";

export default {
schema: "./src/db/schema.ts",
out: "./drizzle",
driver: "turso",

dbCredentials: {
authToken: Bun.env.DATABASE_AUTH_TOKEN,
url: Bun.env.DATABASE_URL!,
},

verbose: true,
strict: true,
} satisfies Config;
No description
3 Replies
LouieMartin
LouieMartinOP15mo ago
// ./src/db/schema.ts
import type { AdapterAccount } from "@auth/core/adapters";
import {
integer,
primaryKey,
sqliteTable,
text,
} from "drizzle-orm/sqlite-core";

export const users = sqliteTable("user", {
id: text("id").notNull().primaryKey(),
name: text("name"),
email: text("email").notNull(),
emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
image: text("image"),
});

export const accounts = sqliteTable(
"account",
{
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
type: text("type").$type<AdapterAccount["type"]>().notNull(),
provider: text("provider").notNull(),
providerAccountId: text("providerAccountId").notNull(),
refresh_token: text("refresh_token"),
access_token: text("access_token"),
expires_at: integer("expires_at"),
token_type: text("token_type"),
scope: text("scope"),
id_token: text("id_token"),
session_state: text("session_state"),
},
(account) => ({
compoundKey: primaryKey(account.provider, account.providerAccountId),
}),
);

export const sessions = sqliteTable("session", {
sessionToken: text("sessionToken").notNull().primaryKey(),
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
});

export const verificationTokens = sqliteTable(
"verificationToken",
{
identifier: text("identifier").notNull(),
token: text("token").notNull(),
expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
},
(vt) => ({
compoundKey: primaryKey(vt.identifier, vt.token),
}),
);
// ./src/db/schema.ts
import type { AdapterAccount } from "@auth/core/adapters";
import {
integer,
primaryKey,
sqliteTable,
text,
} from "drizzle-orm/sqlite-core";

export const users = sqliteTable("user", {
id: text("id").notNull().primaryKey(),
name: text("name"),
email: text("email").notNull(),
emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
image: text("image"),
});

export const accounts = sqliteTable(
"account",
{
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
type: text("type").$type<AdapterAccount["type"]>().notNull(),
provider: text("provider").notNull(),
providerAccountId: text("providerAccountId").notNull(),
refresh_token: text("refresh_token"),
access_token: text("access_token"),
expires_at: integer("expires_at"),
token_type: text("token_type"),
scope: text("scope"),
id_token: text("id_token"),
session_state: text("session_state"),
},
(account) => ({
compoundKey: primaryKey(account.provider, account.providerAccountId),
}),
);

export const sessions = sqliteTable("session", {
sessionToken: text("sessionToken").notNull().primaryKey(),
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
});

export const verificationTokens = sqliteTable(
"verificationToken",
{
identifier: text("identifier").notNull(),
token: text("token").notNull(),
expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
},
(vt) => ({
compoundKey: primaryKey(vt.identifier, vt.token),
}),
);
I'm using WSL with Ubuntu and Bun with Create-Next-App
LouieMartin
LouieMartinOP15mo ago
And if I also just run bun run -b dev it returns this error
No description
LouieMartin
LouieMartinOP15mo ago
I just added bun-types to ./tsconfig.json I'm using ESNext for the target.
Want results from more Discord servers?
Add your server