brocaar / chirpstack-application-server

ChirpStack Application Server is an open-source LoRaWAN application-server.
https://www.chirpstack.io
MIT License
502 stars 325 forks source link

API endpoint GET api/gateways returns right amount of gateways but empty list #632

Closed SeWaS closed 3 years ago

SeWaS commented 3 years ago

What happened?

Using chirpstack-as 3.17.2. We have two gateways in the network. When calling /api/gateways this is the response:

{
  "totalCount": "2",
  "result": []
}

What did you expect?

Swagger docs indicate the following response model:

{
  "result": [
    {
      "createdAt": "2021-10-14T10:44:32.039Z",
      "description": "string",
      "firstSeenAt": "2021-10-14T10:44:32.039Z",
      "id": "string",
      "lastSeenAt": "2021-10-14T10:44:32.039Z",
      "location": {
        "accuracy": 0,
        "altitude": 0,
        "latitude": 0,
        "longitude": 0,
        "source": "UNKNOWN"
      },
      "name": "string",
      "networkServerID": "string",
      "networkServerName": "string",
      "organizationID": "string",
      "updatedAt": "2021-10-14T10:44:32.039Z"
    }
  ],
  "totalCount": "string"
}

I don't expect the list "result" to be empty. Works when querying api/gateways/{id}, by the way.

Steps to reproduce this issue

Steps:

  1. Create API key with is_admin=true

  2. Call

    curl -X GET --header 'Accept: application/json' --header 'Grpc-Metadata-Authorization: Bearer <API_TOKEN>' 'https://<CHIRPSTACK_AS_HOST>/api/gateways'
  3. Result will be as described above

Could you share your log output?

Your Environment

Component Version
Application Server v3.17.2
Network Server v3.15.1
Gateway Bridge 3.9.2-r2
Chirpstack API
Geolocation
Concentratord
SeWaS commented 3 years ago

Figured out that you just have to set a limit which is big enough. Leaving it empty is the same as limit=0. Will close that issue