Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 2.1 version create route with jwt-auth will display an error #862

Closed
idbeta opened this issue Nov 24, 2020 · 3 comments
Closed

bug: 2.1 version create route with jwt-auth will display an error #862

idbeta opened this issue Nov 24, 2020 · 3 comments
Labels
backend bug Something isn't working
Milestone

Comments

@idbeta
Copy link
Contributor

idbeta commented Nov 24, 2020

Bug report

Describe the bug

2.1 version create route with jwt-auth will display an error
btw, create with key-auth or basic-auth also has the problem
image

Request URL: http://127.0.0.1:8080/apisix/admin/routes
Request Method: POST
{"name":"test","desc":"","uris":["/hello"],"methods":["GET","HEAD","POST","PUT","DELETE","OPTIONS","PATCH"],"plugins":{"jwt-auth":{}},"vars":[],"upstream":{"type":"roundrobin","timeout":{"connect":6000,"send":6000,"read":6000},"nodes":[{"host":"127.0.0.1","port":7000,"weight":1}]}}

Response
{"code":10000,"message":"scheme validate failed: properties must be of type object","data":null,"request_id":"fa40087e-bfbf-45a3-a216-2f93e0683c9a"}
@idbeta idbeta added the bug Something isn't working label Nov 24, 2020
@membphis membphis added this to the 2.1.1 milestone Nov 24, 2020
@liuxiran
Copy link
Contributor

liuxiran commented Nov 24, 2020

The issue caused by this hack:

reg := regexp.MustCompile(`\"properties\":\[\]`)

as the schema.json do the format, "properties":[] changed to "properties": []

"properties": [],


The simple and rough way is to modify the regular expression to

reg := regexp.MustCompile(`\"properties\": \[\]`) 

best way is refer to @membphis 's suggestion: #651 (comment), and need @nic-chen 's help

@nic-chen
Copy link
Member

@liuxiran thanks for your remind.

@nic-chen
Copy link
Member

fixed by json schema updated.

and here is a test case for it:
https://github.com/apache/apisix-dashboard/blob/master/api/test/e2e/route_with_auth_plugin_test.go#L38-L58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants