Getting started with KrakenD

9/16/2021

I need some beginner help to KrakenD. I am running it on Ubuntu. The config is provided below.

I am able to reach the /healthz API without problem.

My challenge is that the /hello path returns error 500. I want this path to redirect to a Quarkus app that runs at http://getting-started36-getting-going.apps.bamboutos.hostname.us/.

Why is this not working? If I modify the /hello backend and use a fake host, I get the exacts ame result. This suggests that KrakendD is not even trying to connect to the backend.

In logs, KrakendD is saying:

Error #01: invalid character 'H' looking for beginning of value

kraken.json:

{
      "version": 2,
      "port": 9080,
      "extra_config": {
          "github_com/devopsfaith/krakend-gologging": {
              "level": "DEBUG",
              "prefix": "[KRAKEND]",
              "syslog": false,
              "stdout": true,
              "format": "default"
          }
      },
      "timeout": "3000ms",
      "cache_ttl": "300s",
      "output_encoding": "json",
      "name": "KrakenD API Gateway Service",
      "endpoints": [
          {
              "endpoint": "/healthz",
              "extra_config": {
                  "github.com/devopsfaith/krakend/proxy": {
                      "static": {
                          "data": {       "status": "OK"},
                          "strategy": "always"
                      }
                  }
              },
              "backend": [
                  {
                      "url_pattern": "/",
                      "host": ["http://fake-backend"]
                  }
              ]
          },
          {
              "endpoint": "/hello",
              "extra_config": {},
              "backend": [
                  {
                      "url_pattern": "/hello",
                      "method": "GET",
                      "host": [
                          "http://getting-started36-getting-going.apps.bamboutos.hostname.us/"
                      ]
                  }
              ]
          }
      ]
    }

What am I missing?

-- Billy Billy
kraken.js
krakend
kubernetes
uber-kraken

1 Answer

9/16/2021

add "encoding": "string" to the backend section.

"backend": [
                  {
                      "url_pattern": "/hello",
                      "method": "GET",
                      "encoding": "string" ,
                      "host": [
                          "http://getting-started36-getting-going.apps.bamboutos.hostname.us/"
                      ]
                  }
              ]
-- Billy Billy
Source: StackOverflow