node-mysql2
node-mysql2 copied to clipboard
Unknown error: <nil> when using connection.execute() with local vars
Hi,
Observing frustratingly vague error and I am trying to understand what causes it:
InternalServerErrorException: unknown error: <nil>
The code that causes it; I opted for having dynamic values like that:
await conn.execute('SET @id = 1; SELECT * from table where id = @id;', [])
However if I instead switch it to the snippet below, it works
await conn.execute('SELECT * from table where id = ?;', [1])
.query() doesn't have this problem, however, I'd like to use .execute()
Where this error is coming from? Is that coming directly from exception in await conn.execute() ? Can you share a stack trace?
@sidorares stack is not very verbose either; Yes it is coming directly from await conn.execute()
Error: unknown error: <nil>
at PromiseConnection.execute (path/to/project/.webpack/service/src/lambda-entry-point.js:13318:22)
at MysqlDataAccessService.initializeConnection (/path/to/project/.webpack/service/src/main.js:982:34)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
error obj -
code:'ER_UNKNOWN_ERROR'
errno:1105
message:'unknown error: <nil>'
sql:'SET @id = 1; SELECT * from table where id = @id;'
sqlMessage:'unknown error: <nil>'
sqlState:'HY000'
Hey @sidorares any insights into the issue?
sorry for silence @svetlasyrimis
Can you try the same with non-promise api and see if the error if different?