Jonathan
Jonathan
Explore posts from servers
PPrisma
Created by Jonathan on 6/24/2024 in #help-and-questions
Ensuring Filtering if variable is undefined
I have an application that is a multi-tenant app where we always filter by TenantId , so for example we do queries like this:
var contacts = await db.contacts.findMany({
where: {
tenantId: tenantId,
}
});
var contacts = await db.contacts.findMany({
where: {
tenantId: tenantId,
}
});
While obviously I need to check the tenantId but from a general question, when a a variable sometimes is undefined, it completely ignores that part of query. Some of this is just the nature of how JS objects are built. But I am curious if there is a way to guarantee that the where statement never ignores a variable. I think this is where most query builder alternatives handle by passing variables into a method.
Basically I am curious if there is ways to guarantee that no filter leaks because of a value being undefined.
6 replies
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
I continue to see issues in our error logs in production with prisma using Azure SQL:
Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 3)
Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 3)
The connection string looks like this:
sqlserver://<server>.database.windows.net:1433;database=<dbname>;user=<username>;password=<password>;encrypt=true;trustServerCertificate=true;
sqlserver://<server>.database.windows.net:1433;database=<dbname>;user=<username>;password=<password>;encrypt=true;trustServerCertificate=true;
This is in a nextjs app that we are using it.
8 replies