We're using RocketChat via a Docker image rocketchat/rocket.chat:0.68.4
and the Ruby rocketchat
gem.
There's already some working functionality to update a channel's attributes:
# RocketChatService is a wrapper class for a RocketChat::Session object with authentication as admin
channels = RocketChatService.channels
channels.set_attr(name: id, topic: escape_nil(title)) if title_changed?
channels.set_attr(name: id, description: escape_nil(description)) if description_changed?
channels.set_attr(name: id, custom_fields: { project_id: project_id }) if project_id && project_id_was.nil?
But now we also need to add new users to a room, make them owner, or degrade previous owners. The following code works under certain circumstances (which I'm afraid are to complex to be presented here), but sometimes causes errors:
# idempotent
channels.invite(name: id, username: creator_id)
# TODO: already an owner
channels.add_owner(name: id, username: creator_id)
channels.remove_owner(name: id, username: creator_id_was)
The problem is that these error messages aren't very informative:
"exception"=>"Not allowed [error-not-allowed]"
There's no log file in RocketChat and there's nothing written to stdout
when this happens. That brings me to my question: How can I debug an error message like the one above?