ttnmapper / documentation

Documentation on the working of TTN Mapper.
MIT License
20 stars 6 forks source link

Connect to ttnmapper from a local installed TTS Docker Container #10

Closed beegee-tokyo closed 10 months ago

beegee-tokyo commented 10 months ago

I have a TTS Docker container running on a RPi CM4. When I try to use the Webhook for TTN Mapper, a) I am getting Originating network server header not set error when it tries to send the data from a connected node (b) the Downlink API key stays empty and is not filled as expected.

I am guessing the problem is my local installation in a container. Anyone has an idea?

Here is the error I get:

{
  "name": "as.webhook.fail",
  "time": "2023-09-09T13:24:39.503492768Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "rak4630-as923-3-tracker",
        "application_ids": {
          "application_id": "wisgate-connect"
        },
        "dev_eui": "AC1F09FFFExxxxxx",
        "join_eui": "70B3D57ED0xxxxxx",
        "dev_addr": "01C0xxxx"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
    "namespace": "pkg/applicationserver/io/web",
    "name": "request",
    "message_format": "request",
    "correlation_id": "775a028e573446d1a82498f15751f90a",
    "code": 14,
    "details": [
      {
        "@type": "type.googleapis.com/google.protobuf.Struct",
        "value": {
          "body": "{\"message\":\"Originating network server header not set\",\"success\":false}\n",
          "status_code": 400,
          "url": "https://integrations.ttnmapper.org/tts/v3/uplink-message",
          "webhook_id": "ttn-mapper-webhook"
        }
      }
    ]
  },
  "correlation_ids": [
    "as:up:01H9X1VANSQDDTKDQAC8C1TT8J",
    "gs:conn:01H9X1KBK6G8V2BQFB91P31NVX",
    "gs:up:host:01H9X1KBKGAC4XQ5B3N8RVTMPP",
    "gs:uplink:01H9X1VAF4NR2838HGWZNFNAHY",
    "ns:uplink:01H9X1VAF5DHRNZYVYNMHZSMYN",
    "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H9X1VAF5A72W7X3TA3ZZN71H",
    "rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H9X1VANQZPG1YG3QD2R6G98R"
  ],
  "origin": "e1c472c022f3",
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01H9X1VAYF4ARZKBJM39ZW28MF"
}

In the log of TTS stack I see only

WARN    Failed to process message   {"device_uid": "wisgate-connect.rak4630-as923-3-tracker", "error": "error:pkg/applicationserver/io/web:request (request)", "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.NsAs", "namespace": "applicationserver/io/web", "protocol": "webhooks", "request_id": "01H9X1VANQZPG1YG3QD2R6G98R"}
jpmeijers commented 10 months ago

My first thought is that you may have a missing configuration in TTS's config file. TTN Mapper is very strict when if comes to indentifying where data comes from. If the mapper doesn't know which network the data belongs to, it won't know on which map to include the data.

I know of some people using the mapper along with privately hosted TTS's, so this should be possible.

Could you make your instance send a webhook POST to a dummy endpoint where you can capture the headers and the body? I've done this in the past with a PHP script, but I think there are some services on the internet that does this too.

@beegee-tokyo are you on The Things Network's Slack? Maybe pop me a message there if you are.