Failed query:
I have a function that runs 100k times a day and sometimes i have this error.
Failed query: select
id, .....
Error: Failed query: select id, fingerprint, landing_id, integration_id, type, reference, organization_id, fbclid, formatted_fbclid, metadata, fingerprint_data, created_at, (
SELECT
JSON_ARRAYAGG(
JSON_OBJECT(
'id', c.id,
'name', c.name,
'email', c.email,
'phoneNumber', c.phone_number
)
)
FROM
lead_client lc
INNER JOIN
client c ON lc.client_id = c.id
WHERE
lc.lead_id = l.id
) from lead l where l.id = ?
params: 1678417
at MySql2PreparedQuery.queryWithCache (file:///node_modules/src/mysql-core/session.ts:79:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at MySql2PreparedQuery.execute (file:///node_modules/src/mysql2/session.ts:132:18)
at LeadsRepository.getLeadById (file:///src/modules/leads/leads.repository.ts:173:18)
When I go and run this query on the MySQL client, or I just retry the function it just works, but sometimes it fails, and i don't have any clue why this is happening.
Im not using any type of cache so not sure why i see en th eerror at MySql2PreparedQuery.queryWithCache
do you have any idea how can i start to debug this?
i'm on "drizzle-orm": "0.44.5"
Thanks in advance0 Replies