-
Notifications
You must be signed in to change notification settings - Fork 66
Use vendored dependencies #5
Comments
Hi @nalbion, this is due to golang/go#18827. Basically, the current Docker image embeds a version of the shim which does not use a vendored version of eawsy/aws-lambda-go-core. Waiting for the Golang team to resolve the issue, I will create a new Docker image embedding a version of the shim built with the vendored version of eawsy/aws-lambda-go-core. So that instead of using the |
@nalbion have you created a new Docker image inherited from ours? with govendor installed on it? |
Ok I have nicer solution without the need for a new Docker image. Add the following to your Makefile in order to use your vendor folder as the only source of truth for the Docker image: vendor:
@docker run --rm \
-v $(PWD)/vendor:/go/src -v $(PWD):/tmp \
-e "HANDLER=$(HANDLER)" -e "PACKAGE=$(PACKAGE)" \
eawsy/aws-lambda-go-shim make _all So the only thing you need to do is PS: Do not use /cc @fahernandez |
This is my Dockerfile:
The application should be deployable to Lambda or AppEngine. (maybe I should be using build tags to create 2 distinct apps?) |
(This comment started off as something completely different, but evolved into me talking to myself now - might be helpful to others) According to your docs, you can deploy a zip containing the shim files and func Bar(evt Whatever, ctx *runtime.Context) (interface{}, error) {
log.Println("Hello, World!")
return nil, nil
} to Lambda with config:
...ahhh.... my Makefile is wrong! Your Makefile creates a zip with the structure:
...you didn't mention in the README that it also supports environment variables (kind of weird that you need to read them into Python just to write them back out to the go environment now that I think about it...) |
after fixing my Makefile to write the shim files into the if htyp.NumIn() != 2 || htyp.In(1) != ctyp ||
htyp.NumOut() != 2 || !htyp.Out(1).Implements(reflect.TypeOf((*error)(nil)).Elem()) {
return errorf("Cannot use handler '%s' with invalid signature", hnm)
} If the code provided a different error message for each condition it would be easier to know, but I'm pretty sure that it's getting stuck on I then tried deleting FROM eawsy/aws-lambda-go-shim
RUN yum -q -e 0 -y install git \
&& go get -u -d github.com/eawsy/aws-lambda-go-core/... \
&& go get -u -d github.com/eawsy/aws-lambda-go-event/... ...but then it complains:
I'm not sure which version I should be using. I tried to determine which version you use, but then eventually see this: $ docker run -it eawsy/aws-lambda-go-shim ls -al /go
total 12
drwxr-xr-x 3 root root 4096 Jan 10 22:49 .
drwxr-xr-x 36 root root 4096 Feb 13 12:59 ..
drwxr-xr-x 2 root root 4096 Jan 10 22:49 {bin,pkg,src} |
@nalbion I tried to explain the inner behavior of the shim outside of this issue in the gitter channel. In the meantime, please try the workaround which consists in mounting your vendor folder into the Docker image I will update the README and the example Makefile soon to add this stuff. If you can confirm me that the solution works for you, I would be perfect. For other discussions please fill another issue or let's talk in the gitter channel. Thx. |
@nalbion vendoring supported out of the box with the new release 😉 |
Awesome, thanks! |
Hi,
I've modified your example Makefile slightly (to use govendor) and it generates a zip file which I deploy to Lambda:
index.go:
I deploy with config:
When I test the function in the Lambda web console it responds:
and the logs say:
My Makefile contains:
The text was updated successfully, but these errors were encountered: