devopsfaith / krakend-examples

Collection of examples for the KrakenD framework
Apache License 2.0
75 stars 24 forks source link

httpcache example is not working #4

Closed ghost closed 3 years ago

ghost commented 4 years ago

Hi,

Hope you are all well !

I tried to run the httpcache example but it displays the following error:

  panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x91c62d]

  goroutine 1 [running]:
  github.com/devopsfaith/krakend/router/gin.ginRouter.Run(0xc000138c80, 0xf21998, 0x0, 0x0, 0xc000114ee0, 0xb1fd20, 0xc00010f580, 0xb2ed80, 0xc00010f520, 0x0, ...)
    /go/pkg/mod/github.com/devopsfaith/krakend@v1.1.1/router/gin/router.go:96 +0x3ad
  main.main()
    /app/main.go:56 +0x657

Is it possible to fix ? how to fix it ?

Thanks in advance for your insights or inputs on that topic.

Cheers, X

ghost commented 4 years ago

Here is my config

{
  "version": 2,
  "extra_config": {
    "github_com/devopsfaith/krakend-gologging": {
      "level": "ERROR",
      "prefix": "[PAPER2CODE]",
      "syslog": false,
      "stdout": true,
      "format": "default"
    }
  },
  "timeout": "50000ms",
  "cache_ttl": "300s",
  "output_encoding": "json",
  "name": "paper2code-searx",
  "port": 8080,
  "endpoints": [
    {
      "endpoint": "/searx/{pageno}/{time_range}/{language}/{safesearch}/{q}",
      "method": "GET",
      "extra_config": {},
      "output_encoding": "json",
      "concurrent_calls": 5,
      "querystring_params": [
        "q",
        "pageno",
        "time_range",
        "safesearch",
        "format"
      ],
      "backend": [
        {
          "url_pattern": "/?q={q}&category_general=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "extra_config": {},
          "method": "GET",
      "querystring_params": [ "*" ],
          "disable_host_sanitize": false,
          "host": [
            "http://searx:1979"
          ],
          "group": "web",
          "target": ""
        },
        {
          "url_pattern": "/?q={q}&category_images=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "extra_config": {},
          "querystring_params": [ "*" ],
          "method": "GET",
          "host": [
            "http://searx:1979"
          ],
          "disable_host_sanitize": false,
          "group": "image",
          "target": ""
        },
        {
          "url_pattern": "/?q={q}&category_science=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "extra_config": {},
          "querystring_params": [ "*" ],
          "method": "GET",
          "host": [
            "http://searx:1979"
          ],
          "disable_host_sanitize": false,
          "group": "science",
          "target": ""
        },
        {
          "url_pattern": "/?q={q}&category_it=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "extra_config": {},
          "method": "GET",
          "querystring_params": [ "*" ],
          "host": [
            "http://searx:1979"
          ],
          "disable_host_sanitize": false,
          "group": "it",
          "target": ""
        },
        {
          "url_pattern": "/?q={q}&category_news=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "extra_config": {},
          "method": "GET",
          "querystring_params": [ "*" ],
          "host": [
            "http://searx:1979"
          ],
          "disable_host_sanitize": false,
          "group": "news",
          "target": ""
        },
        {
          "url_pattern": "/?q={q}&category_social+media=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "extra_config": {},
          "method": "GET",
          "querystring_params": [ "*" ],
          "host": [
            "searx:1979"
          ],
          "disable_host_sanitize": false,
          "group": "social",
          "target": ""
        },
        {
          "url_pattern": "/?q={q}&category_videos=1&pageno={pageno}&time_range={time_range}&language={language}&safesearch={safesearch}&format=json",
          "encoding": "json",
          "sd": "static",
          "querystring_params": [ "*" ],
          "extra_config": {},
          "method": "GET",
          "host": [
            "http://searx:1979"
          ],
          "disable_host_sanitize": false,
          "group": "videos",
          "target": ""
        }
      ]
    }
  ]
}
kpacha commented 4 years ago

you're right. the examples from this repo are 2 years old and they use an older krakend release, not compatible with the current one.

we'll try to update the project in the next weeks

ghost commented 4 years ago

yeah, would be awesome to fix them. I managed to create a version with httpcache with diskv but your examples need a refresh.

ghost commented 4 years ago

Any chance to fix them today ? I need it for project ^^

Mistic92 commented 3 years ago

I tried to use them today but failed too :)

azubkokshe commented 3 years ago

Please fix examples :((