Unauthenticated error="rpc error: code = Unauthenticated desc = authentication failed: jwt parse error: token contains an invalid number of segments

Hi there

I know there are some topics talking about this issue and I followed all of them without any success.
I just made a new environment to test some cases, so its a docker env, using rancher to manage all the things.

It worked perfectly until I started to test failover scenarios.

Chirpstack stoped responding the socket. Tried all the tricks I know, no success. Then I made a fresh install.
Cleanup postgres, cleanup redis, started docker containers and voilà, I have a brand new stack up and running. However, my socket still not responding at all.

I’m getting:

28/05/2020 15:02:12INFO[2353] finished streaming call with code Unauthenticated error="rpc error: code = Unauthenticated desc = authentication failed: jwt parse error: token contains an invalid number of segments" grpc.code=Unauthenticated grpc.method=StreamFrameLogs grpc.service=api.GatewayService grpc.start_time="2020-05-28T18:02:12Z" grpc.time_ms=0.087 peer.address="127.0.0.1:36354" span.kind=server system=grpc

As I’m not connected or authenticated.

I’m able to use the public api, generating a jwt token and using it normally.

But once I go to any screen with live information, I’m getting this:

This is my startup log:

28/05/2020 15:15:02WARN[0000] No configuration file found, using defaults. See: https://www.chirpstack.io/application-server/install/config/
28/05/2020 15:15:02INFO[0000] starting ChirpStack Application Server        docs="https://www.chirpstack.io/" version=3.11.0-test.1-3-gdecd110
28/05/2020 15:15:02INFO[0000] storage: setting up storage package
28/05/2020 15:15:02INFO[0000] storage: setup metrics
28/05/2020 15:15:02INFO[0000] storage: setting up Redis client
28/05/2020 15:15:02INFO[0000] storage: connecting to PostgreSQL database
28/05/2020 15:15:02INFO[0000] storage: applying PostgreSQL data migrations
28/05/2020 15:15:02INFO[0000] storage: PostgreSQL data migrations applied   count=0
28/05/2020 15:15:02INFO[0000] integration: configuring global integrations
28/05/2020 15:15:02INFO[0000] integration/mqtt: TLS config is empty
28/05/2020 15:15:02INFO[0000] integration/mqtt: connecting to mqtt broker   server="tcp://broker-lb.vernemq.rancher.internal:21883"
28/05/2020 15:15:02INFO[0000] integration/mqtt: connected to mqtt broker
28/05/2020 15:15:02INFO[0000] integration/mqtt: subscribing to tx topic     qos=0 topic="application/+/device/+/tx"
28/05/2020 15:15:02INFO[0000] api/as: starting application-server api       bind="0.0.0.0:8001" ca_cert= tls_cert= tls_key=
28/05/2020 15:15:02INFO[0000] api/external: starting api server             bind="0.0.0.0:28080" tls-cert= tls-key=
28/05/2020 15:15:02INFO[0000] api/external: registering rest api handler and documentation endpoint  path=/api
28/05/2020 15:15:02INFO[0000] api/js: starting join-server api              bind="0.0.0.0:8003" ca_cert= tls_cert= tls_key=

I’m connecting straight to the service, not using proxy or any load balancer in this case.

Any hint appreciated !

Thanks

are you generate .toml files and make changes in it?

this is normal using docker as it get configs from env. vars

Are you using a proxy? It looks like there is an issue with the forwarding of the JWT tokens in the WebSocket request to the ChirpStack Application Server.

It might be related to this: Rpc error: code = Unauthenticated and Live Frame Logs / Live Event Disconnected - #9 by brocaar (I posted a possible solution using NGINX).