Issue with upgrading Kong custom plugin #7611
-
Kong version 2.5.0 Trying to upgrade a custom plugin developed for Kong version 0.13.0. In this plugin we are extending the API endpoint to add custom functionality. Facing an error around it in the before section of the endpoint config. custom endpoint : /eg-rate-limiting/rules/:rule_name Errors in Kong logs: 2021/07/27 12:32:46 [error] 5004#0: *66 [kong] endpoints.lua:117 [postgres] invalid primary key: '{id="not a primary key",rule_name="missing primary key"}', client: 192.168.33.1, server: kong_admin, request: "GET /eg-rate-limiting/rules/only_request_uri HTTP/1.1", host: "192.168.33.11:8001" The said key rule_name is already a primary key in eg_ratelimiting_rules table in PostgreSQL. schema in daos.lua:
Endpoint config in api.lua:
schema is postgresql db:
Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @narendrapatel! It seems that Kong infers that your endpoint key is an id, which happens by your |
Beta Was this translation helpful? Give feedback.
Hello @narendrapatel!
It seems that Kong infers that your endpoint key is an id, which happens by your
daos.lua
is missing anendpoint_key
field. Please take a look at how it is used in the transformations test plugin. It might fix your issue.