My kong installation is now up with external-oauth plugin activated. But, now faced a different error when configured an ingress to use the same plugin.
Then, when I checked the error log inside the container/pod, I found the following.
2019/12/06 03:47:28 [error] 25#0: *557489 [kong] init.lua:701 …cal/share/lua/5.1/kong/plugins/external-oauth/access.lua:28: attempt to index field ‘api’ (a nil value), client: 10.244.0.0, server: kong, request: “GET /bar/sample HTTP/2.0”, host: “api.example.com:37443”
2019/12/06 03:48:20 [error] 25#0: *557489 lua coroutine: runtime error: …cal/share/lua/5.1/kong/plugins/external-oauth/access.lua:28: attempt to index field ‘api’ (a nil value)
stack traceback:
coroutine 0:
…cal/share/lua/5.1/kong/plugins/external-oauth/access.lua: in function ‘run’
…al/share/lua/5.1/kong/plugins/external-oauth/handler.lua:27: in function <…al/share/lua/5.1/kong/plugins/external-oauth/handler.lua:25>
coroutine 1:
[C]: in function ‘resume’
coroutine.wrap:21: in function coroutine.wrap:21
/usr/local/share/lua/5.1/kong/init.lua:694: in function ‘access’
access_by_lua(nginx-kong.conf:93):2: in main chunk, client: 10.244.0.0, server: kong, request: “GET /bar/sample HTTP/2.0”, host: “api.example.com:37443”
2019/12/06 03:48:20 [error] 25#0: *557489 [kong] init.lua:701 …cal/share/lua/5.1/kong/plugins/external-oauth/access.lua:28: attempt to index field ‘api’ (a nil value), client: 10.244.0.0, server: kong, request: “GET /bar/sample HTTP/2.0”, host: “api.example.com:37443”