liyuntao / kong-init

Declarative configuration tool for Kong
Apache License 2.0
38 stars 8 forks source link

Issue with adding timeout key in services #19

Closed yousafsyed-bg closed 5 years ago

yousafsyed-bg commented 5 years ago

I am trying to add the following in my services

services:
  - name: myservice
    url: http://myservice.local
    connect_timeout: 2000
    retries: 1
    read_timeout: 1200000
    write_timeout: 1200000

kong-init fails with the following error

 WARN  kong_init::client > add_service: 400 Bad Request
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic
Abort trap: 6

I am not an expert in rust so I am not sure what is wrong.

liyuntao commented 5 years ago

@yousafsyed-bg Kong >= 0.14 has a more strictly type check on api payload(db-schema), and currently kong-init choose to parse all fields to string type. So the four fields with number type upon are not valid currently(connect_timeout, retries, read_timeout, write_timeout).

As a temporary solution before next release, you can remove such four fields temporarily, and then modify them via dashboard e.g. konga.

liyuntao commented 5 years ago

fixed in v0.8.0-rc-6 via https://github.com/liyuntao/kong-init/commit/d936247a10bb77232f2ac867b1a30051fcc3c65f