Skip to content

Application is failing when query parameter isn't provided #41

Description

@php-coder
/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Parser.js:437
      throw err; // Rethrow non-MySQL errors
      ^

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
    at Sequence._packetToError (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Query.ErrorPacket (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
    at Protocol._parsePacket (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    --------------------
    at Pool.query (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/Pool.js:199:23)
    at /Users/coder/git/query2app/examples/js/express/mysql/routes.js:37:14
    at Layer.handle [as handle_request] (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
    at /Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:341:12)
    at next (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:275:10)
    at jsonParser (/Users/coder/git/query2app/examples/js/express/mysql/node_modules/.pnpm/[email protected]/node_modules/body-parser/lib/types/json.js:110:7) {
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1",
  sqlState: '42000',
  index: 0,
  sql: 'SELECT id , name , name_ru , slug FROM categories LIMIT NULL'
}

Node.js v18.12.0

Regression after f524f15 (#23)

For golang/chi, it seems like empty parameters is being treated as 0 and a call returns [] as result.
For python/fastapi there is no support for post yet, so it's not affected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions