I have a function that runs 100k times a day and sometimes i have this error.
Failed query: select
id
id
, .....
Error: Failed query: select
id
id
,
fingerprint
fingerprint
,
landing_id
landing_id
,
integration_id
integration_id
,
type
type
,
reference
reference
,
organization_id
organization_id
,
fbclid
fbclid
,
formatted_fbclid
formatted_fbclid
,
metadata
metadata
,
fingerprint_data
fingerprint_data
,
created_at
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
lead
l
l
where
l
l
.
id
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?