Issues when running Drizzle studio on Vercel Postgres

DB Pushing went fine (using Vercel), I can confirm the test table exists, but getting this issue when trying to use studio. It's a sample project using create-t3-app scaffold.
Drizzle Studio is up and running on https://local.drizzle.studio
error: syntax error at or near "-"
at /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:43639:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async proxy (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:60358:24)
at async /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:60500:26
at async dispatch (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37750:21)
at async /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37418:9
at async dispatch (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37750:21)
at async cors2 (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:38926:9)
at async dispatch (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37750:21)
at async /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:38150:29 {
length: 90,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '78',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'scan.l',
line: '1241',
routine: 'scanner_yyerror'
}
Drizzle Studio is up and running on https://local.drizzle.studio
error: syntax error at or near "-"
at /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:43639:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async proxy (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:60358:24)
at async /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:60500:26
at async dispatch (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37750:21)
at async /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37418:9
at async dispatch (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37750:21)
at async cors2 (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:38926:9)
at async dispatch (/projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:37750:21)
at async /projects/my-test-project/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:38150:29 {
length: 90,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '78',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'scan.l',
line: '1241',
routine: 'scanner_yyerror'
}
Solution:
Yeah it seems to be because of the - in the table name. Are you going through Theo tutorial also?
Jump to solution
26 Replies
Gaz
GazOP8mo ago
additional info:
"dependencies": {
"@t3-oss/env-nextjs": "^0.9.2",
"@vercel/postgres": "^0.8.0",
"drizzle-orm": "^0.29.4",
"next": "^14.2.1",
"postgres": "^3.4.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.56.2",
"@types/node": "^20.11.20",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"drizzle-kit": "^0.20.14",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-drizzle": "^0.2.3",
"pg": "^8.11.3",
"postcss": "^8.4.34",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.4.1",
"typescript": "^5.4.2"
},
"ct3aMetadata": {
"initVersion": "7.30.2"
},
"packageManager": "[email protected]"
"dependencies": {
"@t3-oss/env-nextjs": "^0.9.2",
"@vercel/postgres": "^0.8.0",
"drizzle-orm": "^0.29.4",
"next": "^14.2.1",
"postgres": "^3.4.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.56.2",
"@types/node": "^20.11.20",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"drizzle-kit": "^0.20.14",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-drizzle": "^0.2.3",
"pg": "^8.11.3",
"postcss": "^8.4.34",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.4.1",
"typescript": "^5.4.2"
},
"ct3aMetadata": {
"initVersion": "7.30.2"
},
"packageManager": "[email protected]"
ubuntu 22 lts, node 20.12.2, pnpm 9.0.4
Gaz
GazOP8mo ago
No description
Gaz
GazOP8mo ago
looks like similar to someone else's question posted 4 hours ago as well
Solution
g0053
g00538mo ago
Yeah it seems to be because of the - in the table name. Are you going through Theo tutorial also?
⚡Z.E.U.S⚡
⚡Z.E.U.S⚡8mo ago
@Gaz Hey! Can you please share your schema?
Gaz
GazOP8mo ago
that was it
Andrii Sherman
Andrii Sherman8mo ago
it is a bug it should work with any names in table we are trying to reproduce it
Gaz
GazOP8mo ago
export const createTable = pgTableCreator((name) => `my-test-project_${name}`);
export const createTable = pgTableCreator((name) => `my-test-project_${name}`);
removing the hyphens solved it full was this:
// Example model schema from the Drizzle docs
// https://orm.drizzle.team/docs/sql-schema-declaration

import { sql } from "drizzle-orm";
import {
index,
pgTableCreator,
serial,
timestamp,
varchar,
} from "drizzle-orm/pg-core";

/**
* This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same
* database instance for multiple projects.
*
* @see https://orm.drizzle.team/docs/goodies#multi-project-schema
*/
export const createTable = pgTableCreator((name) => `my-test-project_${name}`);

export const posts = createTable(
"post",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt"),
},
(example) => ({
nameIndex: index("name_idx").on(example.name),
})
);
// Example model schema from the Drizzle docs
// https://orm.drizzle.team/docs/sql-schema-declaration

import { sql } from "drizzle-orm";
import {
index,
pgTableCreator,
serial,
timestamp,
varchar,
} from "drizzle-orm/pg-core";

/**
* This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same
* database instance for multiple projects.
*
* @see https://orm.drizzle.team/docs/goodies#multi-project-schema
*/
export const createTable = pgTableCreator((name) => `my-test-project_${name}`);

export const posts = createTable(
"post",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt"),
},
(example) => ({
nameIndex: index("name_idx").on(example.name),
})
);
just messing around with the create t3 scaffold
Andrii Sherman
Andrii Sherman8mo ago
did you push after removing -?
Gaz
GazOP8mo ago
yes sir and db studio started working
Andrii Sherman
Andrii Sherman8mo ago
we will fix it trying to find the cause
Gaz
GazOP8mo ago
if I had to guess, I know pgsql doesn't like hyphens in db/tablenames ideally, and may require some escaping there t3app should likely convert hypens to underscores or something
Andrii Sherman
Andrii Sherman8mo ago
no, it was working on our side yesterday we did an upgrade to studio which may broke something here
Gaz
GazOP8mo ago
if it helps, my vercel db also has a hyphen
g0053
g00538mo ago
Same here
Andrii Sherman
Andrii Sherman8mo ago
@Gaz @g0053 if you will upgrade to latest drizzle-kit, will it work? I see you have 0.20.14
Gaz
GazOP8mo ago
no sir, I actually installed latest via pnpm add drizzle-kit@latest -D after posting this question to see if it helped but it did not
Andrii Sherman
Andrii Sherman8mo ago
got it we really can't reproduce it trying more
Gaz
GazOP8mo ago
it's almost 4:30 am but I can try to create a test repo later to help, should be easy enough
Andrii Sherman
Andrii Sherman8mo ago
We will deploy a fix for UUIDs in another thread, and maybe we accidentally fixed this one too; that's why it's working for us I'll ping you once it's live
Gaz
GazOP8mo ago
ok
Andrii Sherman
Andrii Sherman8mo ago
but you can check any time you want, it's really late for you or I would say really early
Gaz
GazOP8mo ago
yep, will check here when I get up 🙂 good "night"
Andrii Sherman
Andrii Sherman8mo ago
yeah, we did fix it accidentally and were trying to reproduce on a fixed studio :tired: It's updated and should be fixed, please try it!
Gaz
GazOP8mo ago
looks resolved, thanks!
g0053
g00538mo ago
yeah confirm fixed for me also
Want results from more Discord servers?
Add your server