Lukas
Error when using Xata on AWS Lambda
Hello we are trying to deploy a dockerized node.js function to AWS Lambda (with the offical aws lambda node.js docker image), that creates objects with the drizzle ORM and uses the Xata-Http client. When we use this docker image locally we do not face any problems. But when we try to use it uploaded on AWS Lambda we get the following error, we put it in a pastebin because of the limit of characters of Discord:
https://pastebin.com/NQWRLkhC
The (simplfied) code we use is in the .txt file.
The error seems like an problem with xata-http and aws lambda.
Thank u a lot for ur help.
Lukas
3 replies
A problem with Drizzle and Auth.js
Hey I try to use Auth.js together with Drizzle and as the DB Xata.io. I set everything up and then just copied the Drizzle Schema from the official Auth.js site (https://authjs.dev/getting-started/adapters/drizzle) . When I try to do push it to the DB (npx drizzle-kit push) I get the following error:
error: relation "public.user" does not exist
{
length: 349,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: 'SQL statement "ALTER TABLE "post" ADD CONSTRAINT "post_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action"\n' +
'PL/pgSQL function inline_code_block line 2 at SQL statement',
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'namespace.c',
line: '449',
routine: 'RangeVarGetRelidExtended'
}
I tried out a lot and found out that the error comes because of this lines of code:
userId: varchar("user_id", { length: 255 }) .notNull() .references(() => users.id, { onDelete: "cascade" }), <--- But I doesnt find a solution for that. Thank u a lot for ur help. Lukas
userId: varchar("user_id", { length: 255 }) .notNull() .references(() => users.id, { onDelete: "cascade" }), <--- But I doesnt find a solution for that. Thank u a lot for ur help. Lukas
5 replies