Image kong:2.6.0-alpine missing dependencies for Go plugins using embedded server?

Hello,

Migrated custom Go plugin to embedded server following the suggested guide:

Seems that the kong:2.6.0-alpine image does not have the required Google Protobuf dependencies included and loading the plugin config throws:

2021/10/22 08:20:22 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/protoc.lua:334: module load error: google/protobuf/descriptor.proto
google/protobuf/descriptor.proto: No such file or directory
./google/protobuf/descriptor.proto: No such file or directory
/usr/include/google/protobuf/descriptor.proto: No such file or directory
/usr/local/opt/protobuf/include//google/protobuf/descriptor.proto: No such file or directory
/usr/local/kong/lib//google/protobuf/descriptor.proto: No such file or directory
kong/google/protobuf/descriptor.proto: No such file or directory
stack traceback:
[C]: in function ‘error’
/usr/local/share/lua/5.1/protoc.lua:334: in function ‘parsefile’
/usr/local/share/lua/5.1/protoc.lua:505: in function ‘top_parser’
/usr/local/share/lua/5.1/protoc.lua:846: in function ‘parse’
/usr/local/share/lua/5.1/protoc.lua:324: in function ‘parsefile’
…cal/share/lua/5.1/kong/runloop/plugin_servers/pb_rpc.lua:171: in function ‘load_service’
…cal/share/lua/5.1/kong/runloop/plugin_servers/pb_rpc.lua:263: in function ‘new’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:116: in function ‘get_server_rpc’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:218: in function ‘build_phases’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:264: in function ‘get_plugin’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:271: in function ‘load_plugin’
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:136: in function ‘load_plugin_handler’
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:221: in function ‘load_plugin’
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:273: in function ‘load_plugin_schemas’
/usr/local/share/lua/5.1/kong/init.lua:514: in function ‘init’
init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/protoc.lua:334: module load error: google/protobuf/descriptor.proto
google/protobuf/descriptor.proto: No such file or directory
./google/protobuf/descriptor.proto: No such file or directory
/usr/include/google/protobuf/descriptor.proto: No such file or directory
/usr/local/opt/protobuf/include//google/protobuf/descriptor.proto: No such file or directory
/usr/local/kong/lib//google/protobuf/descriptor.proto: No such file or directory
kong/google/protobuf/descriptor.proto: No such file or directory
stack traceback:
[C]: in function ‘error’
/usr/local/share/lua/5.1/protoc.lua:334: in function ‘parsefile’
/usr/local/share/lua/5.1/protoc.lua:505: in function ‘top_parser’
/usr/local/share/lua/5.1/protoc.lua:846: in function ‘parse’
/usr/local/share/lua/5.1/protoc.lua:324: in function ‘parsefile’
…cal/share/lua/5.1/kong/runloop/plugin_servers/pb_rpc.lua:171: in function ‘load_service’
…cal/share/lua/5.1/kong/runloop/plugin_servers/pb_rpc.lua:263: in function ‘new’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:116: in function ‘get_server_rpc’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:218: in function ‘build_phases’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:264: in function ‘get_plugin’
…local/share/lua/5.1/kong/runloop/plugin_servers/init.lua:271: in function ‘load_plugin’
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:136: in function ‘load_plugin_handler’
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:221: in function ‘load_plugin’
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:273: in function ‘load_plugin_schemas’
/usr/local/share/lua/5.1/kong/init.lua:514: in function ‘init’
init_by_lua:3: in main chunk

Plugin is compiled and available “/usr/local/bin/go-request-transformer”.

From dockerfile:
FROM golang:1.17.2-alpine3.14 as builder

FROM kong:2.6.0-alpine

ENV KONG_PLUGINS=bundle,go-request-transformer
ENV KONG_PLUGINSERVER_NAMES=go-request-transformer
ENV KONG_PLUGINSERVER_GO_REQUEST_TRANSFORMER_SOCKET=/usr/local/kong/go-request-transformer.socket
ENV KONG_PLUGINSERVER_GO_REQUEST_TRANSFORMER_START_CMD=/usr/local/bin/go-request-transformer
ENV KONG_PLUGINSERVER_GO_REQUEST_TRANSFORMER_QUERY_CMD="/usr/local/bin/go-request-transformer -dump"

yes, this is missing right now in the packaged images. release 2.6.1 (or 2.7.0 if it comes first) will include it. in the meantime, you can use go-pdk v0.6.1 or, if you wish, include the google protobuf files in /usr/include/google/protobuf.

Thanks Javier,
will be waiting for the next release, currently managed to work it around.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ