Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with production database #66

Closed
mxmzb opened this issue Jan 28, 2020 · 1 comment
Closed

Error with production database #66

mxmzb opened this issue Jan 28, 2020 · 1 comment

Comments

@mxmzb
Copy link
Contributor

mxmzb commented Jan 28, 2020

I would have loved to give a more specific title, but I don't know what's going on. My script complains, that my SQL is faulty, but that's not the case.

I am running serverless-mysql with Zeit (by recommendation) and mysql2 (because mysql package currently doesn't support MySQL 8 auth strategy).

When I ran my script locally with my local database, it works. Now, that I've plugged in a MySQL database from DigitalOcean, I get the following error (and that's sadly the only concrete debugging info I could find). Strangely enough, my queries still seem to go through, as database records do get inserted and updated.

Error: Unknown column 'Sleep' in 'where clause'
    at Packet.asError (/var/task/node_modules/mysql2/lib/packets/packet.js:712:17)
    at Query.execute (/var/task/node_modules/mysql2/lib/commands/command.js:28:26)
    at Connection.handlePacket (/var/task/node_modules/mysql2/lib/connection.js:417:32)
    at PacketParser.onPacket (/var/task/node_modules/mysql2/lib/connection.js:75:12)
    at PacketParser.executeStart (/var/task/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/var/task/node_modules/mysql2/lib/connection.js:82:25)
    at Socket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:308:12)
    at readableAddChunk (_stream_readable.js:289:11)
    at Socket.Readable.push (_stream_readable.js:223:10) {
  code: 'ER_BAD_FIELD_ERROR',
  errno: 1054,
  sqlState: '42S22',
  sqlMessage: "Unknown column 'Sleep' in 'where clause'"
}2020-01-28T10:46:32.481Z	c81ad0f9-ffa4-446e-81a9-4bb0d2aa0ed8	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined","reason":{"errorType":"RangeError","errorMessage":"Invalid status code: undefined","code":"ERR_HTTP_INVALID_STATUS_CODE","stack":["RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined","    at ServerResponse.writeHead (_http_server.js:241:11)","    at ServerResponse._implicitHeader (_http_server.js:232:8)","    at write_ (_http_outgoing.js:607:9)","    at ServerResponse.end (_http_outgoing.js:717:5)","    at send (/var/task/___now_helpers.js:812:13)","    at json (/var/task/___now_helpers.js:826:12)","    at ServerResponse.res.json (/var/task/___now_helpers.js:874:36)","    at exports.default (/zeit/5988ca02/api/test/createPaymentIntent.ts:45:35)","    at processTicksAndRejections (internal/process/task_queues.js:93:5)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined","    at process.<anonymous> (/var/runtime/index.js:35:15)","    at process.emit (events.js:215:7)","    at process.emit (/var/task/__sourcemap_support.js:2535:21)","    at processPromiseRejections (internal/process/promises.js:201:33)","    at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}
Unknown application error occurred
@mxmzb
Copy link
Contributor Author

mxmzb commented Jan 28, 2020

Actually, I tracked it down. In my database logs, I found the following query:

SELECT ID,time FROM information_schema.processlist
WHERE command = "Sleep" AND time >= 900 AND user = 'doadmin'
ORDER BY time DESC

which comes from here. It's the double quotes, firing the query with single quotes around Sleep works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant