Yoni
PPrisma
•Created by Yoni on 2/11/2025 in #help-and-questions
Audit Logging
Hello prisma people. I would like to setup Audit logging on all of the tables in my DB. On the prisma docs/github I see two main ways to achieve this:
1. Using prisma client extensions.
2. Using custom triggers from migrations + client extensions. (~2 years old)
First issue is that I am using in some places the
prisma.$transaction()
function, which apparently is not happy when I try to create the extension on the client for it. Then, the second and last issue I am running into is linking the change in the audit table to the user responsible for this change. I see that in the example provided here: https://github.com/prisma/prisma-client-extensions/tree/main/audit-log-context#2-create-audit-log-triggers, that the "current user" being sent to log in the audit table is sent through client extensions and that seems to be one of the ways to achieve this.
Anyways, what is the most up to date and proper way to do this? Furthermore, is there a fix for auditing queries done with the transaction client?
Thank you!8 replies
PPrisma
•Created by Yoni on 10/15/2024 in #help-and-questions
Error handling
From Docs:
P2001
"The record searched for in the where condition ({model_name}.{argument_name} = {argument_value}) does not exist"
this part of the documentation mentions that this error will be thrown when the record in the "where" clause is not found. I'm performing an update, however when the record is not found it just returns null without actually returning an error. I would expect the ORM to return error P2001...
Any help would be greatly appreciated!
3 replies
PPrisma
•Created by Yoni on 9/30/2024 in #help-and-questions
AWS SAM + Lambda not bundling properly.
Hi guys. I'm writing an AWS SAM template in which I am setting up Prisma with my Lambda functions to interact with my RDS Postgres DB. I am facing an error that I suspect might be related to the query engine and prisma.schema not being bundled with the code. The error I am getting is:
Clearly theres an issue with the client being generated for my local machine rather than the lambda. I even tried this in my prisma client instatiation but no luck:
I also tried setting this in the lambda's environment variables:
PRISMA_QUERY_ENGINE_LIBRARY: /opt/nodejs/node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node
(Deps in layers)
Any help would be appreciated. Cheers!2 replies