0

We want to rename kong apikey name from apikey to api_key, for that we tried

curl -X POST http://localhost:8001/plugins/ \
    --data "name=request-transformer"  \
    --data "config.rename.headers=apikey:api_key"

as described here
We get

{"code":5,"fields":{"consumer":null,"service":null,"route":null,"name":"request-transformer"},"message":"UNIQUE violation detected on '{consumer=null,name="request-transformer",route=null,service=null}'","name":"unique constraint violation"}

Then,request is updated as

curl -X POST http://localhost:8001/plugins \
    --data "name=request-transformer"  \
    --data "name=ourservice" \
    --data "config.rename.headers=apikey:api_key"

result :

{"code":2,"fields":{"name":"expected a string"},"message":"schema violation (name: expected a string)","name":"schema violation"}

We use docker based kong API GW (kong 2.7.1)

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94
  • 1
    Do you need the user to provide the key as `apikey`, or could you configure the Key Authentication plugin using `config.key_names=api_key` to remove the need to add a transform? – Michael Heap Apr 19 '22 at 13:08
  • @MichaelHeap We already have configured key as `apikey`, now we need to modify to `api_key` – Sachith Muhandiram Apr 19 '22 at 13:24
  • 1
    Do you already have a request transformer plugin configured on `ourservice`? – Michael Heap Apr 19 '22 at 13:26
  • @MichaelHeap No, we do not at the moment. Do we need to enable `transformer` plugin? – Sachith Muhandiram Apr 19 '22 at 15:57
  • 2
    The second error is because you have two name on the post. The first error seems relative to an already global plugin configured. Can you do a GET on `/plugins` to check if you don't have an already one set up ? – Ôrel Apr 19 '22 at 17:25

0 Answers0