Update plugin (PUT) on kong 1.3

On Kong 1.2 I didn’t have this issue, it started with kong 1.3 (i have downgraded for now)

The issue is the following; whenever I update my plugins, the service attached to the plugin gets replaced with null (the service is still available, but it creates a service-less plugin which is then applied to all my services.)

Update a plugin with a service already attached to it:

PUT localhost:8001/plugins/e7313ad5-6294-4509-bbc9-86e550ac21d7

{
  "name": "key-auth",
  "config": {
    "key_names": [
      "apikey",
      "key"
    ],
    "hide_credentials": true,
    "key_in_body": false,
    "run_on_preflight": true
  },
  "enabled": true
}

returns:

{
    "data": {
        "config": {
            "anonymous": null,
            "hide_credentials": true,
            "key_in_body": false,
            "key_names": [
                "apikey",
                "key"
            ],
            "run_on_preflight": true
        },
        "consumer": null,
        "created_at": 1571670787,
        "enabled": true,
        "id": "e7313ad5-6294-4509-bbc9-86e550ac21d7",
        "name": "key-auth",
        "protocols": [
            "grpc",
            "grpcs",
            "http",
            "https"
        ],
        "route": null,
        "run_on": "first",
        "service": null, <-------- (My service ID gets replaced with null)
        "tags": null
    },
    "result": true
}

The service previously attached to the plugin is now replaced with null

Is there a way to update my plugin without touching the service ID as it was before?

Thanks,
Sartigan

I think there was a PR that changed the behavior of PUT at one point. I will say I think you meant to do PATCH though as a PUT generally entails a full payload and PATCH is the method where you can update 1 element at a time without passing everything eh?

Maybe it was this PR? https://github.com/Kong/kong/pull/5006

-Jeremy

1 Like