apache / apisix-dashboard

Dashboard for Apache APISIX
https://apisix.apache.org/
Apache License 2.0
1.01k stars 527 forks source link

dashboard can not start when a custom discovery plugins enabled #2691

Open jagerzhang opened 1 year ago

jagerzhang commented 1 year ago

Issue description

我们给APISIX集成了一个内部的服务发现插件,在上游配置中,这个服务发现插件配置格式如下:

 "discovery_type": "polaris",
  "discovery_args": { // 这里可以配置一些额外的后端节点筛选逻辑。
            "namespace": "Production",
            "metadata": {},
            "metadata_router": "ruleBasedRouter"
  },

目前已经正常在生产环境使用,但是启用这个插件且给上游如上配置之后,dashboard无法启动,报错为:

2022-12-13T04:40:13.088Z    ERROR   store/store.go:370  json unmarshal failed: json: cannot unmarshal object into Go struct field Upstream.discovery_args of type string
2022-12-13T04:40:13.088Z    ERROR   store/storehub.go:73    GenericStore init error: json unmarshal failed
    Related Key:        ibn_archi_gns3
    Error Description:  json: cannot unmarshal object into Go struct field Upstream.discovery_args of type string
2022-12-13T04:40:13.088Z    ERROR   server/store.go:32  init stores fail: %!w(*errors.errorString=&{json unmarshal failed
    Related Key:        ibn_archi_gns3
    Error Description:  json: cannot unmarshal object into Go struct field Upstream.discovery_args of type string})
2022-12-13T04:40:13.088Z    ERROR   cmd/root.go:79  The Manager API server start failed: json unmarshal failed
    Related Key:        ibn_archi_gns3
    Error Description:  json: cannot unmarshal object into Go struct field Upstream.discovery_args of type string
Error occurred while initializing logical store:  /apisix-guangzhou/upstreams
Error: json unmarshal failed
    Related Key:        ibn_archi_gns3
    Error Description:  json: cannot unmarshal object into Go struct field Upstream.discovery_args of type string
Usage:
  manager-api [flags]
  manager-api [command]

Available Commands:
  help        Help about any command
  version     show manager-api version

Flags:
  -c, --config string     config file
  -h, --help              help for manager-api
  -p, --work-dir string   current work directory (default ".")

Use "manager-api [command] --help" for more information about a command.

json unmarshal failed
    Related Key:        ibn_archi_gns3
    Error Description:  json: cannot unmarshal object into Go struct field Upstream.discovery_args of type string

看起是 discovery_args 字段属性校验失败,求问下修复方法,多谢~

Expected behavior

None

How to Reproduce

None

Screenshots

No response

Environment

Additional context

No response

Baoyuantop commented 1 year ago

Hi @jagerzhang, have you tried to synchronize schema information? You can refer here https://apisix.apache.org/docs/dashboard/FAQ/#4-after-modifying-the-plugin-schema-or-creating-a-custom-plugin-in-apache-apisix-why-cant-i-find-it-on-the-dashboard