Invalid Wire type in gRPC request for tenants

Hi there :wave:,
I’m trying to get tenant information from gRPC API with Python and I’m getting a problem that I can’t deal with due to my probable bad knowledge of Protobuf.
When I’m doing:

req = api.GetGatewayRequest()
req.gateway_id = gateway["gatewayId"]
resp = client.Get(req, metadata=auth_token)

It works well. gateway[“gatewayId”] is a string, like: 009000000002a39b

But if I do the same for a tenant, for instance with:

req = api.GetTenantRequest()
req.id = tenant["id"]
resp = client.Get(req, metadata=auth_token)

Where tenant[“id”] is a string like : ab86993d-518c-4643-a2f5-9bb127752da4

I get:
failed to decode Protobuf message: GetTenantRequest.id: invalid wire type: Varint (expected LengthDelimited)

Can someone explains what is the difference and how to deal with that?

The error indicates that it is looking for a variable int, but you are correct that tenant ID is a UUID string (Protocol documentation - ChirpStack open-source LoRaWAN® Network Server documentation). It looks like there is a mismatch somewhere between the client library, server, or something else. Are you sure the code that is populating the ID is being interpreted as a string by Python?

1 Like

type(tenant[“id”])
gives:
<class 'str'>
So it seems to be interpreted as string.
I also updated the lib but it still fails.

Hi @brocaar, do you think I should open an issue into github?

Could you provide a ready to use code example in which I can copy and paste a tenant ID? Then I will try to reproduce the issue.

1 Like

My Bad. I mixed 2 requests, that is why I had a mismatch.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.