Error "code: 13, details: 'Received HTTP status code 400'" with gRPC API Request

Hello,

I am encountering an error when attempting to send a request using the following versions:

"@chirpstack/chirpstack-api": "^4.11.0"
"@grpc/grpc-js": "^1.12.5"

The error is as follows:

code: 13,
details: 'Received HTTP status code 400',

Here is the code I’m using:

this.client = new ApplicationServiceClient(
  '<address>',
  credentials.createSsl(),
);

const metadata = new Metadata();
metadata.add('authorization', `Bearer <token>`);

const request: ListApplicationsRequest = new ListApplicationsRequest();
request.setTenantId('<tenantId>');
request.setLimit(10);
request.setOffset(0);

this.client.list(request, metadata, (error, response) => {
  if (error) {
    console.log(error);
  } else {
    console.log(response);
  }
});

However, requests made via the web interface work as expected.

To simulate the request, I tried sending it via HTTP:

this.http
  .post(
    '<address>',
    '<payload as in request from web interface>',
    {
      headers: {
        Authorization: 'Bearer <token>',
        'Content-type': 'application/grpc-web-text',
      },
    },
  )
  .subscribe(console.log, console.error);

This also works, and even the REST API works well:

GET <rest-api-address>/api/applications?tenantId=<tenantId>&limit=10
Authorization: Bearer <token>

While I can use REST, I would prefer to use gRPC as recommended. Can anyone suggest what might be wrong with my gRPC request setup or what could be causing this HTTP 400 error?

Did you specify the page size? I remember getting errors like these, due to omitting some parameter that is actually required.

Thanks for your suggestion! I tried adding limit and offset to the request like this:

request.setLimit(10);
request.setOffset(0);

Unfortunately, the same error persists:

code: 13,
details: 'Received HTTP status code 400',

I also updated my original post to reflect this change.

From my experience with the REST API, if limit is not provided, it still works but returns "totalCount" and an empty array of results. This suggests that limit is likely not a required parameter.