PrismaP
Prisma6mo ago
5 replies
tudor galt

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:

const form = await prisma.forms.create({
            data: formData
        });

The formData looks like this:
const formData = {
userId,
isComplete: false,
treatmentType: user?.treatmentType || TREATMENT_TYPE.TBD,
isArchived: false,
formType: 'Youth',
isCaregiver: !!isCaregiver,
...(sessionId && { sessionId })
        };


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:
const user = await prisma.users.findUnique({
            where: { id: userId }
        });
.


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:
npx prisma -v
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
prisma                  : 6.12.0
@prisma/client          : 6.12.0
Computed binaryTarget   : debian-openssl-1.1.x
Operating System        : linux
Architecture            : x64
Node.js                 : v22.14.0
TypeScript              : 5.8.3
Query Engine (Node-API) : libquery-engine 8047c96bbd92db98a2abc7c9323ce77c02c89dbc (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
PSL                     : @prisma/prisma-schema-wasm 6.12.0-15.8047c96bbd92db98a2abc7c9323ce77c02c89dbc
Schema Engine           : schema-engine-cli 8047c96bbd92db98a2abc7c9323ce77c02c89dbc (at node_modules/@prisma/engines/schema-engine-debian-openssl-1.1.x)
Default Engines Hash    : 8047c96bbd92db98a2abc7c9323ce77c02c89dbc
Studio                  : 0.511.0

Do you have any ideas what could be wrong or how I can fix this?
Was this page helpful?