P
Prisma•5mo ago
aeolian

Ugly logs

When prisma logs an error, I seem to get the whole generated client bundle logged. Is there something I'm doing wrong here or an easy fix? I'
5 Replies
Prisma AI Help
Prisma AI Help•5mo ago
You opted for speed from this bot. Let's conjure up an answer right now!
aeolian
aeolianOP•5mo ago
No description
Prisma AI Help
Prisma AI Help•5mo ago
If you're seeing huge, unreadable logs (sometimes including the whole generated client bundle or minified code) when Prisma logs an error, this is a known issue that has affected various users. By default, Prisma can output very verbose error messages, especially if not configured otherwise. Solution:
You can control the verbosity of error logs by setting the errorFormat option when instantiating your PrismaClient. For the simplest output, use:
const prisma = new PrismaClient({
errorFormat: 'minimal',
})
const prisma = new PrismaClient({
errorFormat: 'minimal',
})
This will reduce the error output to just the essential message, making it much more readable and easier to handle in logs or error handlers. This approach is confirmed to work and is the recommended fix for the "gigantic output" problem in error logs Difficult to read error report, Gigantic output on error. Note:
- If you still see large or minified logs after setting errorFormat: 'minimal', ensure you are using an up-to-date version of Prisma, as some older versions had bugs where this setting was ignored. - In some environments (like Prisma Studio), there are still open issues with error display due to minified code, but for most CLI and server use cases, the above setting should help Error popups are unreadable in Studio because of minified sources. Summary:
Set errorFormat: 'minimal' in your PrismaClient constructor to avoid ugly, verbose error logs. If issues persist, consider updating Prisma to the latest version. 🤔 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.
Ramparts
Ramparts•5mo ago
also raised this before, minimal does nothing. only "fix" i have found is to wrap all code in a try catch, then look ONLY at error.message, not error
aeolian
aeolianOP•5mo ago
Ah cheers. weird one... haha

Did you find this page helpful?