DT
Join ServerDrizzle Team
help
RangeError: Maximum call stack size exceeded - When I try to INSERT
Hi,
I am getting
I am using
I have a page to add an organization with the following action:
putOrg functions in a
when this line get executed, I get the following error:
I think the issues I am having is similar to this: https://discord.com/channels/1043890932593987624/1092908217983578184 but I am not 100% sure.
Any help is much appreciated.
Thanks
I am getting
RangeError: Maximum call stack size exceeded
when I try to INSERT something in the DB, SELECT queries works with no issues.I am using
"drizzle-orm": "^0.25.3"
and "@remix-run/react": "^1.15.0"
.I have a page to add an organization with the following action:
export const action = async ({ request, context }: ActionArgs) => {
const db = getDbFromContext(context);
const { errors, data } = await getValidatedFormData<FormData>(
request,
resolver
);
if (errors) {
return json(errors);
}
const org = await putOrg(db, data);
return org;
};
putOrg functions in a
server.ts
file:export async function putOrg(db: DrizzleD1Database, org: newOrg) {
const ts = new Date().getUTCSeconds();
const Org: NewOrgsModel = {
id: uuid(),
name: org.org,
description: org.description,
updatedAT: ts,
createdAT: ts,
};
try {
const insert = await db.insert(orgs).values(Org).returning().run();
return insert;
} catch (e) {
console.log("error catched: " + e);
}
}
when this line get executed, I get the following error:
[wrangler] RangeError: Maximum call stack size exceeded
[wrangler] at deprecate (/private/Users/macvim/remix_project/functions/[[path]].js:45405:10)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:14)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
[wrangler] at warned (/private/Users/macvim/remix_project/functions/[[path]].js:45408:33)
org
schema is defined here:export const orgs = sqliteTable(
"orgs",
{
id: text("ID").notNull(),
name: text("Name").notNull(),
description: text("Description").notNull(),
updatedAT: integer("Updated_at").notNull(),
createdAT: integer("Created_at").notNull(),
},
(orgs) => ({
compositePk: primaryKey(orgs.id),
stripeCheckoutSessionIdIdx: index("orgsId").on(orgs.id),
})
);
I think the issues I am having is similar to this: https://discord.com/channels/1043890932593987624/1092908217983578184 but I am not 100% sure.
Any help is much appreciated.
Thanks
@macvim Could you try to simply execute an select statement with filter like:
await db.select().from(users).where(eq(users.id, 42));
If you get the same error it‘s related to https://discord.com/channels/1043890932593987624/1092908217983578184 like you mentioned
await db.select().from(users).where(eq(users.id, 42));
If you get the same error it‘s related to https://discord.com/channels/1043890932593987624/1092908217983578184 like you mentioned
@s1njar I have this select statement that works:
db.select().from(orgs).where(eq(orgs.id, orgID)).get();
I guess then it‘s not related to this issue https://discord.com/channels/1043890932593987624/1092908217983578184
anything wrong I am doing with my implementation?
It took me a while to figure this out, but the issue was not related to Drizzle. for the ID, I was using
uuidv4
package, after switching to uuid
I was able to run my statement.