Base t3 app throwing: Dynamic Server error on build

Noticed I was getting a Dynamic server error on a recent t3 app using postgress with Drizzle and I realized simply changing out the Drizzle client (and config) causes the build process to throw a Dynamic server usage error on build. Placing cookies() in the default RSC that comes with T3 seems to cause the error to go away, but that feels like a bit of a hack. Is this also something that occurs with the planetscale setup or is there something wrong with my Drizzle client? Update: I just actually created a planetscale account to test out default settings and it appears the error gets thrown with default planetscale/drizzle as well. Is this a known issue or are there any workarounds? Thanks Drizzle client
import { drizzle } from "drizzle-orm/postgres-js";

import { env } from "~/env";
import * as schema from "./schema";
import postgres from "postgres"

const client = postgres(env.DATABASE_URL)

export type Drizzle = typeof db
export const db = drizzle(client, { schema });
import { drizzle } from "drizzle-orm/postgres-js";

import { env } from "~/env";
import * as schema from "./schema";
import postgres from "postgres"

const client = postgres(env.DATABASE_URL)

export type Drizzle = typeof db
export const db = drizzle(client, { schema });
Drizzle config
import { type Config } from "drizzle-kit";

import { env } from "~/env";

export default {
schema: "./src/server/db/schema.ts",
driver: "pg",
dbCredentials: {
connectionString: env.DATABASE_URL,
},
tablesFilter: ["debug_*"],
} satisfies Config;
import { type Config } from "drizzle-kit";

import { env } from "~/env";

export default {
schema: "./src/server/db/schema.ts",
driver: "pg",
dbCredentials: {
connectionString: env.DATABASE_URL,
},
tablesFilter: ["debug_*"],
} satisfies Config;
6 Replies
kaleembhatti
kaleembhatti11mo ago
i had a similar issue (i think) the problem was with trpc the question thread https://discord.com/channels/966627436387266600/1194039579129421924
Tribe
TribeOP11mo ago
From reading endless threads it seems like forcing dynamic appears to be the recommended way around this, next does have a blog post regarding this, I just dont understand why T3 doesnt include this in the setup and instead just lets the error be thrown on build? If anyone involved with T3 could give an explanation that would be a huge piece of mind. thanks
Sturlen
Sturlen11mo ago
I was able to replicate this error with drizzle/planetscale as well. I found an issue on Github, but it appears to be marked as "solved", but there are comment about someone else seeing the same problem: https://github.com/t3-oss/create-t3-app/issues/1599#issuecomment-1884212057
GitHub
bug: 7.22.0 next build error TRPCClientError: Dynamic server usag...
Provide environment information "ct3aMetadata": { "initVersion": "7.22.0" }, Describe the bug Reproduction repo . To reproduce when: install: pnpm create t3-app@latest...
Tribe
TribeOP11mo ago
yeah thats the frustrating part, it just keeps getting flagged as solved but no one addresses the error being thrown or even mentions if its just safe to ignore
Sturlen
Sturlen11mo ago
it might be best to create a new issue then with all the details and to showcase that it's still relevant for the latest version
Tribe
TribeOP11mo ago
probably the case, Im always just scare to open issues on githubs I dont work for, fully expecting to get steamrolled for not knowing something basic lol
Want results from more Discord servers?
Add your server