Closed r3dsm0k3 closed 4 years ago
Hey @r3dsm0k3 - the PR you linked above has been merged; thanks for reporting. I'm closing this for now, but feel free to reopen or create a new issue.
A new version of the pluginserver will be tagged shortly!
I'm still suffering this issue. I'm pretty sure the go-pluginserver I'm using has the fix.
type Config struct {
Test []string json:"test"
}
kong.yml config: test:
But kong(alpine latest version) reports another error: elements = { type = "expected a string" } } } }) stack traceback: [C]: in function 'assert' /usr/local/share/lua/5.1/kong/init.lua:427: in function 'init' init_by_lua:3: in main chunk
I am having the same issue.
type Config struct {
Claims []string
}
Logs from the wait-for-db
container:
init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:427: error loading plugin schemas: on plugin 'jwt-claim-headers': [postgres] schema violation (fields.1: {
fields = {
{
elements = {
type = "expected a string"
}
}
}
})
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/kong/init.lua:427: in function 'init'
init_by_lua:3: in main chunk
Run with --v (verbose) or --vv (debug) for more details
waiting for db
Here are some verbose debug logs:
@westwin @SkippyZA what version of pluginserver are you using? Could you Retry with the latest version available and report back?
@gszr I am using the latest from master.
Here is my dockerfile I use to build my kong image with plugins:
#####################
## Go plugins
#####################
FROM kong:2.0-ubuntu as compiler
USER root
# Install build tools
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -q curl build-essential ca-certificates git
# Download and configure Go compiler
RUN curl -s https://storage.googleapis.com/golang/go1.13.5.linux-amd64.tar.gz | tar -v -C /usr/local -xz
ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV PATH $PATH:/usr/local/go/bin
# Copy and compile go-plugins
RUN mkdir /tmp/go-plugins
WORKDIR /tmp/go-plugins
COPY plugins/ /tmp/go-plugins/
RUN go get github.com/Kong/go-pluginserver
RUN make deps
RUN make all
#####################
## Release image
#####################
FROM kong:2.0-ubuntu
RUN mkdir -p /usr/local/kong \
&& chown -R kong:0 /usr/local/kong \
&& chmod -R g=u /usr/local/kong
USER kong
# Copy Go files
COPY --chown=kong --from=compiler /tmp/go-plugins/build/*.so /usr/local/kong/
COPY --chown=kong --from=compiler /go/bin/go-pluginserver /usr/local/bin/go-pluginserver
Thanks @SkippyZA. Could you retry with this proposed patch: https://github.com/Kong/go-pluginserver/pull/20
What would be the easiest way to do that @gszr ?
You could, for example, clone the repo rather than doing a go get
and do make
(the pluginserver repo has a Makefile).
I have it compiled, but now it is failing to start because of a version issue
Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:64: 2020/06/15 21:06:36 failed to open plugin jwt-claim-headers: plugin.Open("/usr/local/kong/jwt-claim-headers"): plugin was built with a different version of package github.com/Kong/go-pdk/bridge
@SkippyZA make sure to recompile your plugin with the same version of the go-pdk used in that branch - which I just looked and is v0.3.0 (if your plugin has a go mod file, it's just a matter of changing the version number)
Great, got it to compile and the plugin loads and works as expected now.
Thank you so much for verifying, @SkippyZA! I will re-review the fix and get it merged ASAP!
Thanks @gszr
Im trying to write a config schema which looks like this
and trying to load the configuration from a declarative config file.
This configuration is resulting in an error
I made sure the yaml is valid so there's no issue there. I'm able to parse the other fields though.
Can anyone help me explain what am I doing wrong here or if it is a bug in the go-pdk itself?
At this point I'm stuck and any help would be appreciated. Thanks