bundle.zip is generated using these steps (this only contains manifest.json since file_list is empty):
docker run -it --rm -v $(pwd):/app --entrypoint /bin/bash tykio/tyk-gateway:v4.0.5
cd /app
/opt/tyk-gateway/tyk bundle build
Next I tried to run gRPC server using
go mod init tyk-plugin
go mod tidy
But it is throwing this error
❯ go mod tidy
go: finding module for package github.com/TykTechnologies/tyk-protobuf/bindings/go
go: finding module for package google.golang.org/grpc
go: finding module for package golang.org/x/net/context
go: found golang.org/x/net/context in golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b
go: found google.golang.org/grpc in google.golang.org/grpc v1.49.0
go: finding module for package github.com/TykTechnologies/tyk-protobuf/bindings/go
tyk-plugin imports
github.com/TykTechnologies/tyk-protobuf/bindings/go: module github.com/TykTechnologies/tyk-protobuf@latest found (v0.0.0-20220714214409-d0cb35aefc54), but does not contain package github.com/TykTechnologies/tyk-protobuf/bindings/go
An up-to-date golang gRPC authentication plugin example should be added/updated in custom-plugins repo. Do we have any other repo/example that I can run?
I have seem this example. This works and gRPC server is started at port 9111 but I am unable to use this with latest version of tyk v4.0.5 probably because of incompatible coprocess bindings. I am using this api def
curl -s 'http://localhost:8081/keyless-test/get' -H "Authorization: Basic $(echo -n foo:bar | base64)"
{
"error": "Access to this API has been disallowed"
}
Also this example doesn’t have manifest file which can be used to generate bundle.zip (Probably this is required as per docs)
This example doesn’t need to be bundled. Running the gRPC server is sufficient.
This is how I got it running in my setup.
go get -u github.com/TykTechnologies/tyk-grpc-go-basicauth-jwt
go install tyk-grpc-go-basicauth-jwt
go run main.go
INFO[0000] starting grpc middleware on :9111
I ran into this error when running the above commands
go: github.com/Sirupsen/[email protected]: parsing go.mod:
module declares its path as: github.com/sirupsen/logrus
but was required as: github.com/Sirupsen/logrus
go: github.com/Sirupsen/[email protected]: parsing go.mod:
module declares its path as: github.com/sirupsen/logrus
but was required as: github.com/Sirupsen/logrus
Thanks. I can confirm that existing gRPC server works with latest tyk v4.0.5 after setting coprocess_options in tyk.conf and using example api definition file. But I think something is wrong with go.mod. I get this error if I run go mod vendor (after resolution of Sirupsen/logrus with replace statements that you mentioned).
go1.15.15 mod vendor
go: finding module for package github.com/hashicorp/terraform/flatmap
github.com/TykTechnologies/tyk-grpc-go-basicauth-jwt imports
github.com/TykTechnologies/tyk-protobuf/bindings/go imports
github.com/TykTechnologies/tyk/apidef imports
github.com/TykTechnologies/tyk/log imports
github.com/hashicorp/terraform/flatmap: module github.com/hashicorp/terraform@latest found (v1.2.8), but does not contain package github.com/hashicorp/terraform/flatmap
I want to use 3rd party packages that’s why tidy and vendor command should work with go v1.15.15 (supported by tyk).