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?