matrix-org / matrix-org/matrix-viewer

❗ Unable to fetch rooms from room directory exception: `Invalid server name: action:add-new-server`

Open
#244 0 comments 0 reactions 0 assignees View on GitHub
A-room-directory T-Defect
Dominant language
JavaScript
Stars
84
Forks
10
PR merge metrics
No merged PRs in 30d

Description

This error **occurred** after I selected the add new server from the dropbar without JavaScript enabled ( #243 ). But also, if the user typed in an inaccessible HS, they should be greeted with a friendlier message in general.

> The exact error we ran into was:

```
Error: HTTP Error Response: 400 Bad Request: {"errcode":"M_INVALID_PARAM","error":"Invalid server name: action:add-new-server"}
URL=https://matrix.org/_matrix/client/v3/publicRooms?server=action%3Aadd-new-server
at checkResponseStatus (/app/server/lib/fetch-endpoint.js:21:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async fetchEndpoint (/app/server/lib/fetch-endpoint.js:44:3)
at async fetchEndpointAsJson (/app/server/lib/fetch-endpoint.js:69:15)
at async fetchPublicRooms (/app/server/lib/matrix-utils/fetch-public-rooms.js:29:36)
at async /app/server/tracing/trace-utilities.js:31:24
at async /app/server/routes/room-directory-routes.js:52:62
```

> The error _occured_ **[sic]** with these search parameters:

```
{
"homeserver": "action:add-new-server",
"searchTerm": "archive",
"limit": 9
}
```

Contributor guide

Open the contributing guide

Research direction

Start with server/routes/room-directory-routes.js and trace the request into server/lib/matrix-utils/fetch-public-rooms.js and server/lib/fetch-endpoint.js. Reproduce the add-new-server and inaccessible-homeserver cases, then verify that invalid searches do not send the action value as a homeserver and that users receive a friendlier error message.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.