Received http2 header with status: 400, grpc_status:13

Viewed 19

Hi,
I'm running Chirpstack v4.15.0 on Red Hat Openshift.
I'm trying to use the API with Python and gRPC but I have the following error:

<_InactiveRpcError of RPC that terminated with:
	status = StatusCode.INTERNAL
	details = "Received http2 header with status: 400"
	debug_error_string = "UNKNOWN:Error received from peer  {grpc_message:"Received http2 header with status: 400", grpc_status:13}"
>

I set the debug level to TRACE but the container wrote only this:

2025-10-22T07:42:53.942963Z DEBUG gRPC{uri=/api.DeviceService/Get}: chirpstack::api: Started processing request
2025-10-22T07:42:53.943003Z INFO gRPC{uri=/api.DeviceService/Get}: chirpstack::api: Finished processing request status="400" latency=53.601µs

Someone can help me to understand where is the error ?

Thanks in advance
Marco

#!/usr/bin/env python3
"""
Legge la configurazione completa di un device in ChirpStack v4 via gRPC API.
Recupera anche le chiavi OTAA direttamente dal server.
"""
import sys
import grpc
from chirpstack_api import api

def main(host, port, api_token, dev_eui):
    server = f"{host}:{port}"
    
    print(f"Connecting to {server}")
    channel = grpc.insecure_channel(server)
    auth_token = [("authorization", f"Bearer {api_token}")]
    client = api.DeviceServiceStub(channel)

    # --- Legge il device dal server ---
    try:
        print(f"Request info about the device '{dev_eui}'")
        client_response = client.Get(
            api.GetDeviceRequest(dev_eui=dev_eui),
            metadata=auth_token
        )
        device = client_response.device
        print("=== Device ===")
        print(f"Name: {device.name}")
        print(f"DevEUI: {device.dev_eui}")
        print(f"JoinEUI: {device.join_eui}")
        print(f"Description: {device.description}")
        print(f"Application ID: {device.application_id}")
        print(f"Device Profile ID: {device.device_profile_id}")
    except grpc.RpcError as e:
        print(f"Error: {e.details()} (code {e.code()})")
        print(e)        
        sys.exit(1)

    # --- Legge le chiavi OTAA dal server ---
    try:
        print(f"Request info about OTAA keys of the device '{dev_eui}'")
        keys_response = client.GetKeys(
            api.GetDeviceKeysRequest(dev_eui=dev_eui),
            metadata=auth_token
        )
        keys = keys_response.device_keys  # <-- attenzione: i valori reali sono dentro device_keys
        print("\n=== Chiavi OTAA ===")
        print(f"AppKey: {keys.app_key}")
        print(f"NwkKey: {keys.nwk_key}")
    except grpc.RpcError as e:      
        print(f"Error: {e.details()} (code {e.code()})")
        print(e)
        sys.exit(1)

    sys.exit(0)

if __name__ == "__main__":
    if len(sys.argv) != 5:
        print(f"Usage: {sys.argv[0]} <HOST> <PORT> <API_TOKEN> <DEVICE_EUI>")
        sys.exit(1)

    host = sys.argv[1]   
    port = sys.argv[2]   
    api_token = sys.argv[3]   
    dev_eui = sys.argv[4]   
    main(host, port, api_token, dev_eui)
1 Answers