Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Bug when calling REST API for room messages

Open afaizal opened this issue 10 years ago • 3 comments

Got Error: Cannot return null or undefined from an endpoint: get api/rooms/:id/messages/:ts\n at packages/nimble_restivus/lib/route.coffee:61:25\n

Tried testing by giving invalid room ID.

The error handling seems to be missing. Any advice ?

afaizal avatar Jun 03 '16 06:06 afaizal

I can advice you to pass only valid room IDs until someone fix that :smile:

sampaiodiego avatar Jun 03 '16 12:06 sampaiodiego

@afaizal What version of Rocket Chat did you use to test the above scenario. I tested the above route with version 0.33 and here is the output

curl -H "X-Auth-Token: jtia1b3kqkN4IgcTBuyTZ_-TlSTjqSkJ4PxKiGeV1eI" -H "X-User-Id: ibHxrcoR66M2wNf7d" http://localhost:3000/api/rooms/nonexistingroom/messages
{
  "status": "fail",
  "message": "Error :: Invalid room [error-invalid-room]"

`

Deepakkothandan avatar Jun 11 '16 16:06 Deepakkothandan

thanks @Deepakkothandan .. I tried and got the same result.

sampaiodiego avatar Jun 13 '16 13:06 sampaiodiego