-
Notifications
You must be signed in to change notification settings - Fork 98
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
SDK does not work with Rocket.Chat 7.1.0 #169
Comments
I have the same problem, because i believe the problem is linked not to the sdk, but the validation and types on the server side, I've created an issue on the rocket chat server repo : RocketChat/Rocket.Chat#34131 |
Same Problem over here. RocketChat/Rocket.Chat#34131 is closed as a duplicate. |
Yeah, I didn't react to them closing as duplicate out of frustration, as it is a breaking change introduced by a minor version update of the server, not the sdk... One option would be to close that issue and reopen it there as that is what they were proposing, but not sure that's what they really meant. For now, as the fix is a single line, the change is directly into my Dockerfile after installation of the dependencies of my bot, to not have a local version or fork but you can imagine that is not an ideal solution... RUN sed -i 's/this\.bot = { i: integrationId };/this.bot = true;/g' \
node_modules/@rocket.chat/sdk/dist/lib/message.js A lot of things were talked about on many issues, like moving the sdk to a new repo under their monorepo, turning this SDK to open source, but I'm not sure where they're at right now. The mobile branch of the sdk is still getting updated, but the community could need a nice update on that I think. |
Okay guuuys some updates ! 🥳 There was a merged pull request on the server-side link They fixed the server-side breaking change for the sdk (even if the fix was nearly flagged as a ... breaking-change 😅 ) It should apparently be brought in for the 7.2.0 ! Thanks a lot to @sampaiodiego, merry Christmas and happy new year in advance to all ! |
Description
Rocket.Chat 7.1.0 introduced several data validations for security reasons. This includes the field
bot
of a message: https://github.com/RocketChat/Rocket.Chat/blob/develop/apps/meteor/app/lib/server/methods/sendMessage.ts#L135This field is documented to be a Boolean: https://developer.rocket.chat/v1-api/apidocs/message
However, the SDK sets the field
bot
to{i: 'js.SDK'}
(https://github.com/RocketChat/Rocket.Chat.js.SDK/blob/master/src/lib/message.ts#L17). Although the valuejs.SDK
is configurable via the environment variableINTEGRATION_ID
, this value is always put intobot.i
.Rocket.Chat 7.0.0 allows arbitrary data for the
bot
field which is why the SDK works with Rocket.Chat 7.0.0. Using Rocket.Chat 7.1.0, sending a message fails.Steps to reproduce
Expected result
Actual result
Server-side logs:
Quick fix
Changing https://github.com/RocketChat/Rocket.Chat.js.SDK/blob/master/src/lib/message.ts#L17 from
to
allows the bot to send messages to Rocket.Chat 7.1.0:
However, fixing this properly would include changing the
integrationId
to be a Boolean or to completely get rid of it.The text was updated successfully, but these errors were encountered: