Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

can not find deno with https://github.com/lambci/docker-lambda? #81

Closed
davidxiao opened this issue May 28, 2020 · 5 comments · Fixed by #82
Closed

can not find deno with https://github.com/lambci/docker-lambda? #81

davidxiao opened this issue May 28, 2020 · 5 comments · Fixed by #82

Comments

@davidxiao
Copy link

davidxiao commented May 28, 2020

hi,
I tried to play this with local lambda, while getting the below error:

111 #### PATH=/var/task/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
222 #### pwd=/var/task
/var/task/bootstrap: line 238: deno: command not found

line 238 is below line, i tried to echo out the path and pwd
https://github.com/hayd/deno-lambda/blob/master/runtime/bootstrap#L236

reckon if it's related to lambda image ? because that deno can not run in Mac as well

BTW, what is https://github.com/hayd/deno-lambda/releases/download/1.0.2/amz-deno.gz and what it's for?

@davidxiao davidxiao changed the title how to develop and debug with lambda and dynamodb? can not find deno with localstack? May 28, 2020
@davidxiao davidxiao changed the title can not find deno with localstack? can not find deno with https://github.com/lambci/docker-lambda? May 28, 2020
@hayd

This comment has been minimized.

@davidxiao
Copy link
Author

davidxiao commented May 28, 2020

yeah, i downloaded deno-lambda-layer.zip and unzipped it, then ran in the dir with unzipped files:
docker run -d -e DOCKER_LAMBDA_STAY_OPEN=1 -p 9001:9001 -v "$PWD":/var/task:ro,delegated lambci/lambda:provided handler

bootstrap was running, so got the error message from bootstrap, the only thing I can think of now is reckon it's related to lambda OS?

@hayd

This comment has been minimized.

@hayd
Copy link
Contributor

hayd commented May 29, 2020

Ah, got it:

The layer must be added as a layer (mounted at /opt)! Whilst the app itself is at /var/task. So, you can do the following:

❱ docker run -it --rm -v "$PWD":/var/task:ro,delegated -v "$PWD":/opt:ro,delegated lambci/lambda:provided hello.handler
START RequestId: c95f0609-b763-183e-56f2-22e72c2dae99 Version: $LATEST
END RequestId: c95f0609-b763-183e-56f2-22e72c2dae99
REPORT RequestId: c95f0609-b763-183e-56f2-22e72c2dae99	Init Duration: 244.58 ms	Duration: 9.18 ms	Billed Duration: 100 ms	Memory Size: 1536 MB	Max Memory Used: 30 MB

{"statusCode":200,"headers":{"content-type":"text/html;charset=utf8"},"body":"Welcome to deno 1.0.2 🦕"}

Using stay open:

❱ docker run -e DOCKER_LAMBDA_STAY_OPEN=1 -p 9001:9001 -it --rm -v "$PWD":/var/task:ro,delegated -v "$PWD":/opt:ro,delegated lambci/lambda:provided hello.handler
Lambda API listening on port 9001...

in another shell:

❱ aws lambda invoke --endpoint http://localhost:9001 --no-sign-request --function-name deno-func --payload '{}' output.json
{
    "StatusCode": 200,
    "ExecutedVersion": "$LATEST"
}
❱ cat output.json
{"statusCode":200,"headers":{"content-type":"text/html;charset=utf8"},"body":"Welcome to deno 1.0.2 🦕"}

It probably makes sense to store the layer in a separate directory.

@davidxiao
Copy link
Author

davidxiao commented May 29, 2020

yeah, sorry for late response, just had chance come now, can close the ticket

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants