Skip to content

bug: The path parameter must be provided when updating the Secret resource with the PATCH method #9503

Description

@guoqqqi

Current Behavior

  1. Use the PATCH method to update the Secret resource:
curl http://127.0.0.1:9180/apisix/admin/secrets/vault/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -XPATCH -d '{
    "token" : "apisix"
}'

{"error_msg":"no secret id and/or sub path in uri"}
  1. Update the Secret resource using the PATCH method, with the path parameter as normal.
curl http://127.0.0.1:9180/apisix/admin/secrets/vault/1/token -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -XPATCH -d '"apisix"'

{"value":{"prefix":"/apisix/kv","token":"apisix","uri":"https://localhost/vault","id":"vault/1","update_time":1684399820,"create_time":1684395392},"key":"/apisix/secrets/vault/1"}

Expected Behavior

Update Secret resource using PATCH method, supports no path parameter.

Error Logs

No response

Steps to Reproduce

  1. Run APISIX via the Docker image
  2. Create new secrets configuration.
curl -i http://127.0.0.1:9180/apisix/admin/secrets/vault/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -XPUT -d '
{
    "uri": "http://xxx/get",
    "prefix" : "apisix",
    "token" : "apisix"
}'
  1. Update the secrets configuration.
curl http://127.0.0.1:9180/apisix/admin/secrets/vault/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -XPATCH -d '{
    "token" : "apisix"
}'

see the error: {"error_msg":"no secret id and/or sub path in uri"}

Environment

  • APISIX version (run apisix version): v3.2.0
  • Operating system (run uname -a): M1
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions