Unable to create API with service discovery

Hi,

EDIT: Looks like this is a duplicate of [Can not save service_discovery settings with tyk dashbaord v1.7.0]. Is a fix planned?

I’m trying to link my API definition to my service discovery endpoint, without success.

First I’m wondering why the “Target URL” field is mandatory if the service discovery is enabled ? I’m not able to save the API if it’s not filled in, and it does not make sense to me as the final target is given by the service discovery itself.

I tried to leave it with a dummy value and fill the required configuration of the service discovery section.
Whenever I do it, if I refresh, the configuration is lost.

I have inspected the called endpoint when the API is updated and it appears the all the service discovery fields are misplaced in the sent JSON:

Notice how the “service discovery” section is empty, while all its properties (with the correct values) are copied into its parent object…


“proxy”: {
“target_url”: “http://httpbin.org/”,
“endpoint_returns_list”: true,
“cache_timeout”: 0,
“parent_data_path”: “location”,
“service_discovery”: {
“endpoint_returns_list”: false,
“cache_timeout”: 0,
“parent_data_path”: “”,
“query_endpoint”: “”,
“use_discovery_service”: false,
“target_path”: “”,
“use_target_list”: false,
“use_nested_query”: false,
“data_path”: “”,
“port_data_path”: “”
},
“check_host_against_uptime_tests”: false,
“transport”: {
“ssl_ciphers”: [

    ],
    "ssl_min_version": 0,
    "proxy_url": ""
  },
  "target_list": [
    
  ],
  "query_endpoint": "http://10.100.2.241:9876/services",
  "_sd_show_port_path": true,
  "preserve_host_header": false,
  "use_target_list": false,
  "strip_listen_path": true,
  "use_nested_query": true,
  "data_path": "host",
  "port_data_path": "port",
  "enable_load_balancing": false,
  "listen_path": "/discovery",
  "disable_strip_slash": false
},

If I manually edit the API in the raw editor and copy all the fields one by one in the correct place, it looks like it’s querying my service discovery endpoint as expected.

Fixed raw config:

“service_discovery”: {
“endpoint_returns_list”: true,
“cache_timeout”: 0,
“parent_data_path”: “location”,
“query_endpoint”: “http://10.100.2.241:9876/services”,
“use_discovery_service”: true,
“target_path”: “”,
“use_target_list”: false,
“use_nested_query”: true,
“data_path”: “host”,
“port_data_path”: “port”
}

I assume there is a bug here… ^^

(I’m using the latest version of the gateway)

Thomas

Hi
This bug should be fixed in next 2.7 patch and 2.8