bobmusinex
bobmusinex
DTDrizzle Team
Created by bobmusinex on 10/21/2024 in #help
Type Error when inserting into table
I'm getting as error when trying to insert into a table using:
await db.insert(users).values({
id: userId,
email: email,
passwordHash: passwordHash
});
await db.insert(users).values({
id: userId,
email: email,
passwordHash: passwordHash
});
I can run the insert successfully in Drizzle Runner. The error:
TypeError: Cannot read properties of undefined (reading 'insert')
at default (/Users/**********/WebDev/*****-********/src/routes/signup/+page.server.ts:45:12)
at async Module.handle_action_json_request (/Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js:51:16)
at async resolve (/Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/runtime/server/respond.js:454:18)
at async Module.respond (/Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/runtime/server/respond.js:327:20)
at async file:///Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:524:22
TypeError: Cannot read properties of undefined (reading 'insert')
at default (/Users/**********/WebDev/*****-********/src/routes/signup/+page.server.ts:45:12)
at async Module.handle_action_json_request (/Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js:51:16)
at async resolve (/Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/runtime/server/respond.js:454:18)
at async Module.respond (/Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/runtime/server/respond.js:327:20)
at async file:///Users/**********/WebDev/*****-********/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]._a77vxbboh36tqqtsa3niclnpnu/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:524:22
8 replies
DTDrizzle Team
Created by bobmusinex on 10/18/2024 in #help
Drizzle Studio fails to run due to TypeError
pnpm drizzle-kit studio, won't launch Studio. It was working fine, but I added a few new tables and relations to my schema and it won't launch. The strangest part is generate and migrate run without errors. Here is the error output:
No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/**********/WebDev/*****-********/drizzle.config.ts'
TypeError: Cannot read properties of undefined (reading 'reduce')
at one (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/drizzle-orm/relations.cjs:207:21)
at <anonymous> (/Users/**********/WebDev/*****-********/src/lib/db/schema/auth.ts:21:8)
at Relations.config (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/drizzle-orm/relations.cjs:194:22)
at extractTablesRelationalConfig (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/drizzle-orm/relations.cjs:165:32)
at prepareServer (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:64894:85)
at Object.handler (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:87579:28)
at async run (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:85613:7)
No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/**********/WebDev/*****-********/drizzle.config.ts'
TypeError: Cannot read properties of undefined (reading 'reduce')
at one (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/drizzle-orm/relations.cjs:207:21)
at <anonymous> (/Users/**********/WebDev/*****-********/src/lib/db/schema/auth.ts:21:8)
at Relations.config (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/drizzle-orm/relations.cjs:194:22)
at extractTablesRelationalConfig (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/drizzle-orm/relations.cjs:165:32)
at prepareServer (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:64894:85)
at Object.handler (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:87579:28)
at async run (/Users/**********/WebDev/*****-********/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:85613:7)
6 replies