Skip to content

fix: replace deprecated getUserRoles method call with REST API#1104

Merged
Spiral-Memory merged 3 commits intoRocketChat:developfrom
deepak0x:fix/api-get-user-roles-legacy
Mar 21, 2026
Merged

fix: replace deprecated getUserRoles method call with REST API#1104
Spiral-Memory merged 3 commits intoRocketChat:developfrom
deepak0x:fix/api-get-user-roles-legacy

Conversation

@deepak0x
Copy link
Contributor

@deepak0x deepak0x commented Jan 24, 2026

This PR fixes a 400 Bad Request error encountered when the application attempts to fetch user roles (specifically admin roles).

The previous implementation relied on a legacy Meteor method call (method.call/getUserRoles) via the DDP-over-REST endpoint. This method has been deprecated or removed in modern Rocket.Chat server versions, causing the API to return a 404 Method Not Found error (wrapped inside a 400 response).

This change updates the getUserRoles implementation to use the supported REST API endpoint roles.getUsersInRole, restoring compatibility with modern Rocket.Chat servers.


Closes #1099

Changes

Updated packages/api/src/EmbeddedChatApi.ts:

  • Replaced the legacy getUserRoles() implementation with a call to this.getUsersInRole("admin").

  • Preserved the existing return structure ({ result: [...] }) to maintain backward compatibility with:

    • useFetchChatData
    • memberStore

@Spiral-Memory
Copy link
Collaborator

Pls resolve the conflicts

@Spiral-Memory Spiral-Memory added chore a subtle fix nudge minor tweaks suggested labels Mar 21, 2026
@deepak0x
Copy link
Contributor Author

hey @Spiral-Memory
conflicts resolved

@Spiral-Memory Spiral-Memory removed the nudge minor tweaks suggested label Mar 21, 2026
@Spiral-Memory Spiral-Memory merged commit e1a4d84 into RocketChat:develop Mar 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore a subtle fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: getUserRoles fails with 400/404 on modern Rocket.Chat versions

2 participants