BUG: Attempting to subscribe to an invalid category ID causes the server to close #10

Closed
opened 2020-12-31 19:40:03 +02:00 by hiimgoodpack · 3 comments
Contributor

Subscribing to an invalid category ID closes the server.

As an example, if you send 42/gateway,["subscribe",["a"]] through the websocket, the server closes.

This seems to be happening on line api/v1/gateway/index.js:233

Subscribing to an invalid category ID closes the server. As an example, if you send `42/gateway,["subscribe",["a"]]` through the websocket, the server closes. This seems to be happening on line api/v1/gateway/index.js:233
hippoz added the
bug
label 2020-12-31 21:44:55 +02:00
Author
Contributor

It seems like on Node v12.20.0, it doesn't crash, but instead creates a UnhandledPromiseRejectionWarning.

It seems like on Node v12.20.0, it doesn't crash, but instead creates a UnhandledPromiseRejectionWarning.
Owner

Can you send it here in a code block?

Can you send it here in a code block?
Author
Contributor

When I try to join the channel a, it tells me

(node:3214) UnhandledPromiseRejectionWarning: CastError: Cast to ObjectId failed for value "a" at path "_id" for model "Category"
    at model.Query.exec (/home/brainlet/brainlet/node_modules/mongoose/lib/query.js:4368:21)
    at model.Query.Query.then (/home/brainlet/brainlet/node_modules/mongoose/lib/query.js:4460:15)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3214) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3214) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
When I try to join the channel `a`, it tells me ``` (node:3214) UnhandledPromiseRejectionWarning: CastError: Cast to ObjectId failed for value "a" at path "_id" for model "Category" at model.Query.exec (/home/brainlet/brainlet/node_modules/mongoose/lib/query.js:4368:21) at model.Query.Query.then (/home/brainlet/brainlet/node_modules/mongoose/lib/query.js:4460:15) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:3214) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3214) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ```
hippoz referenced this issue from a commit 2021-01-03 17:04:54 +02:00
This repo is archived. You cannot comment on issues.
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hippoz/brainlet#10
No description provided.