Kong / kong-python-pdk

Write Kong plugins in Python (Experimental)
Apache License 2.0
40 stars 14 forks source link

Vault module missing get() method? #143

Open shawnchapla-8451 opened 1 month ago

shawnchapla-8451 commented 1 month ago

Trying to use the PDK to read a secret from Kong vault:

eg_public_key = kong.vault.get("vault://azure/eg-pbk-certs")

However, when this executes:

2024/05/13 15:41:01 [info] 2387#0: *1525 [python-plugin:2400]   File "/usr/local/kong/python/jwt-validator.py", line 111, in __init__, context: ngx.timer
2024/05/13 15:41:01 [info] 2387#0: *1525 [python-plugin:2400]     eg_public_key = kong.vault.get("vault://azure/eg-pbk-certs"), context: ngx.timer
2024/05/13 15:41:01 [info] 2387#0: *1525 [python-plugin:2400] AttributeError: module 'kong_pdk.pdk.kong.vault' has no attribute 'get', context: ngx.timer
2024/05/13 15:41:01 [error] 2395#0: *2568 [kong] init.lua:247 [e451-jwt-validator] starting instance: module 'kong_pdk.pdk.kong.vault' has no attribute 'get', client: 192.168.65.1, server: kong, request: "GET /jwttest HTTP/1.1", host: "localhost:8000", request_id: "f110d743b81f6750e86b1a4fc69ecc4e"

I can see it defined here, so not sure how to resolve this. I'm pulling v0.36 of the kong-pdk package, which I believe is the most current (though apparently nearly a year old at this point).