getting error "prisma:error Must call super constructor ..." at a simple insert
So, I get this error "prisma:error Must call super constructor in derived class before accessing 'this' or returning from derived constructor" when doing this insert:
The formData looks like this:
And the model in schema has all those fields and then some
The
prisma
variable seems to be instantiated&configured correctly, because this query, which is in the same function, above the erroring one, returns successfully:
.
Now github's copilot and gemini from Microsoft couldn't come up with a working solution/workaround, and neither did google search results.
My environment:
Node 22.14,
Prisma:
Do you have any ideas what could be wrong or how I can fix this?3 Replies
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into
#ask-ai
for a quick spin!The error message you are seeing is not a Prisma specific error. This typically occurs when you have a class that extends another class and you try to use this before calling super() in the constructor.
Have you extended the PrismaClient class anywhere in your codebase?
Thanks for coming back to me. No, I didn't extend the Prisma class, nor did I do any advanced or complicated operations with the instance.
This is how I instantiate it:
This is getting weirder: I have this code snippet, which throws that error at the last
.findMany
, all the others working normally:
when querying by id, it works:
And the model for that table looks like this (it has the elementId
column)