Closed adlabac closed 1 year ago
An exception is raised when executing the query() method, if the results contains records with bit(1) columns with NULL values:
query()
bit(1)
NULL
Exception { "errorType": "TypeError", "errorMessage": "Cannot read properties of null (reading '0')", "stack": [ "TypeError: Cannot read properties of null (reading '0')", " at Connection.castField (/var/task/rest.js:30:52)", " at RowDataPacket.parse (/var/task/node_modules/mysql/lib/protocol/packets/RowDataPacket.js:33:24)", " at Query.RowDataPacket (/var/task/node_modules/mysql/lib/protocol/sequences/Query.js:153:10)", " at Protocol._parsePacket (/var/task/node_modules/mysql/lib/protocol/Protocol.js:260:14)", " at Parser._parsePacket (/var/task/node_modules/mysql/lib/protocol/Parser.js:433:10)", " at Parser.write (/var/task/node_modules/mysql/lib/protocol/Parser.js:43:10)", " at Protocol.write (/var/task/node_modules/mysql/lib/protocol/Protocol.js:38:16)", " at Socket. (/var/task/node_modules/mysql/lib/Connection.js:88:28)", " at Socket. (/var/task/node_modules/mysql/lib/Connection.js:526:10)", " at Socket.emit (node:events:513:28)" ] }
My bad. The issue was actually caused by the custom typeCast() function which caused the exception.
typeCast()
Please delete or close the issue.
An exception is raised when executing the
query()
method, if the results contains records withbit(1)
columns withNULL
values:Exception (/var/task/node_modules/mysql/lib/Connection.js:88:28)",
" at Socket. (/var/task/node_modules/mysql/lib/Connection.js:526:10)",
" at Socket.emit (node:events:513:28)"
]
}
{ "errorType": "TypeError", "errorMessage": "Cannot read properties of null (reading '0')", "stack": [ "TypeError: Cannot read properties of null (reading '0')", " at Connection.castField (/var/task/rest.js:30:52)", " at RowDataPacket.parse (/var/task/node_modules/mysql/lib/protocol/packets/RowDataPacket.js:33:24)", " at Query.RowDataPacket (/var/task/node_modules/mysql/lib/protocol/sequences/Query.js:153:10)", " at Protocol._parsePacket (/var/task/node_modules/mysql/lib/protocol/Protocol.js:260:14)", " at Parser._parsePacket (/var/task/node_modules/mysql/lib/protocol/Parser.js:433:10)", " at Parser.write (/var/task/node_modules/mysql/lib/protocol/Parser.js:43:10)", " at Protocol.write (/var/task/node_modules/mysql/lib/protocol/Protocol.js:38:16)", " at Socket.