ReferenceError: Must call super constructor in derived class before accessing 'this' or returning...
Hi there! I am using Prisma ORM to use PostgreSQL. Whenever I try to update a value, I get the following error:
The function that updates the value:
Wallet table:
6 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
The error message “ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor” is not a typical Prisma error, but rather a JavaScript/TypeScript class inheritance issue. However, in the context of Prisma, this error can sometimes be triggered if there is a problem with how the Prisma Client is generated, imported, or used.
Based on the knowledge sources, similar PrismaClientValidationError issues have been reported when:
- The Prisma Client import path is incorrect or the generated client is not up-to-date with your schema. For example, importing from a wrong path or from a folder that does not contain the generated client can cause runtime errors. Double-check that your import path matches the generated client location and that you have run
prisma generate after any schema changes. See related import issues and solutions in this discussion and this issue.
- There is a mismatch between the Prisma Client version and the generated files, or the client was not regenerated after a dependency update or schema change. Always run npx prisma generate after updating your schema or Prisma version.
- The Prisma Client is not being instantiated correctly, or there are issues with the environment (e.g., running in an unsupported runtime or bundler).
What you should do:
1. Ensure your import path is correct and points to the generated Prisma Client.
2. Run npx prisma generate to regenerate the client.
3. Make sure your Prisma Client and @prisma/client versions match.
4. If you are using a monorepo or custom output directory, double-check the path and build steps.
If the problem persists after these steps, please provide more details about your project structure and Prisma setup. The knowledge sources do not contain a direct match for your exact error, but these steps address the most common cause
s for similar issues in Prisma projects source source.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Node version: 23.11.0
Hey!
As a quick test, can you remove output path from your schema.prisma file, regenerate Prisma Client in default location and check if you get the same error?
That fixed the error, thanks! I was passing an invalid type to Prisma, but instead of showing the proper error I was getting the aforementioned gibberish. Should I use the default path instead of generated one?
Yes, please continue using the generated path
Ok, thanks!