question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebSockets - Badly formatted JSON crashes server

See original GitHub issue

Not typically an issue if using @trpc/client to interact with your WebSocket endpoint, but a bad/unknowing actor could send the following payload to a trpc WebSocket endpoint and cause it to throw an uncaught runtime error TRPCError: 'id' is required and crash the NodeJS process.

{
  "id": null,
  "method": "query",
  "params": {
    "path": "test"
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jlalmescommented, Mar 1, 2022

Great job @KATT 🎉

0reactions
github-actions[bot]commented, Oct 4, 2022

This issue has been locked because it had no new activity for 14 days. If you are running into a similar issue, please create a new issue. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to ensure a WebSocket message is JSON string ...
Yes. On the server you absolutely need to worry about malformed input. If sending invalid JSON makes your server crash, that's really bad....
Read more >
RangeError: out of range index crashing server #778 - GitHub
I concur. Upgrading to 1.1.1 (got pulled automatically by npm when upgrading to a newer socket.io release) has resolved this. May be beneficial ......
Read more >
Warren James Day on Twitter: "Curious. How would you test for this ...
WebSockets - Badly formatted JSON crashes server · Issue #1575 · trpc/trpc. Not typically an issue if using @trpc/client to interact with your...
Read more >
Sending JSON over WebSockets - JavaScript Tutorial - YouTube
In today's video I'll be showing you how to send JSON data over WebSockets between the client and server - this is very...
Read more >
Validating & Structuring JSON over WebSockets - YouTube
In today's video I'll be going over a general technique of structuring and validating your JSON when sending it over a WebSockets connection ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found