RocketChat / RocketChat/Rocket.Chat

back-compatibility in realtime api causes 500 "Internal server error"

Open
#31,410 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

Hi, since the last update to 6.5.0 the parameter back-compatibility for the realtime api is broken and causes a 500 Internal Server Error.

We have build some bots which are using the the back-compatibility flag set to true to have the msg event as "added" instead of "changed" but this is not broken since the update 6.5.0 (also broken in 6.5.2)

Steps to reproduce:
  1. Install RocketChat 6.5.0
  2. Connect to Realtime Api with the following parameters:
ddp.Sub("stream-room-messages", "__my_messages__", true)
  1. Get the error
Expected behavior:

I would except that my client can connect as documented and no Internal Server Error is thrown

Actual behavior:

RocketChat is responding to the subscribton command with a internal server error

	"name":"DDP-Streamer",
	"msg":"Subscription error",
	"err":{
	"type":"TypeError",
	"message":"Cannot read property 'added' of undefined",
	"stack":"TypeError: Cannot read property 'added' of undefined
	\n    at Object.added [as sendAdded] (/app/ee/apps/ddp-streamer/src/Publication.js:39:21)
	\n    at Stream._publish (/app/apps/meteor/server/modules/streamer/streamer.module.js:148:34)
	\n    at runMicrotasks (<anonymous>)
	\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)
	\n    at async Server.subscribe (/app/ee/apps/ddp-streamer/src/Server.js:94:13)"}}
Server Setup Information:
  • Version of Rocket.Chat Server: 6.5.0 (also tested with 6.5.2)
  • Deployment Method: docker
Client Setup Information
  • Go SDK
Additional context

Docs of the API we use: https://developer.rocket.chat/reference/api/realtime-api/subscriptions/streamlivechatroom

A workaround so far i have found would be to set the back-compatibility to false but then the msg is "changed" and not "added" which need additional changes in the lower level libraries like ddp.

Relevant logs:

Server logs are above.
Client logs:

debug sub returned a nosub error msg=map[error:map[error:500 errorType:Meteor.Error isClientSafe:true message:Internal server error [500] reason:Internal server error] id:2 msg:nosub]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ee/apps/ddp-streamer/src/Publication.js at line 39, then trace the call from apps/meteor/server/modules/streamer/streamer.module.js line 148 and Server.js line 94. Reproduce the stream-room-messages subscription with back-compatibility set to true. Done means the documented subscription no longer returns a 500 and preserves the expected compatibility behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.