Closed davidxiao closed 4 years ago
That example just has a hello.ts
file – where are you expecting deno
to come from?
This works for me:
deno-lambda-layer.zip
and unzipdeno-lambda-example.zip
and unzipdeno-lambda-layer
docker run --rm \
-v "$PWD":/opt \
-v "$PWD/../deno-lambda-example":/var/task \
lambci/lambda:provided hello.handler
Lambda layers mount at /opt
and handler code mounts at /var/task
hi, @mhart , thanks very much for so quick response,
my bad, i had used all under /var/task,
i got error when invoked(tried both of below):
aws lambda invoke --endpoint http://localhost:9001 --no-sign-request --function-name deno-func --payload '{}' output.json
aws lambda invoke --endpoint http://localhost:9001 --no-sign-request \ --function-name myfunction --payload '{}' output.json
Could not connect to the endpoint URL: "http://localhost:9001/2015-03-31/functions/deno-func/invocations"
how to specify the function name when deploying if possible?
or what function name i should use by default if i can not specify the function name when deploying?
where is 2015-03-31
from, i found in bootstrap, there is 2018-06-01/runtime
string, don't know if it's related?
I can't see the command you're using to invoke docker-lambda. If you want to run in stay-open mode, you need to pass -e DOCKER_LAMBDA_STAY_OPEN=1
– are you doing that?
Function name doesn't matter – you can use what you like. The 2015-03-31
is from the Lambda API – that's the correct URL
I used the below command to start, then invoke it via the commands in previous comments
docker run -d \ -e DOCKER_LAMBDA_STAY_OPEN=1 \ -v "$PWD":/opt \ -v "$PWD/../example":/var/task \ lambci/lambda:provided hello.handler
I can see the below message after start:
Lambda API listening on port 9001...
then invoked it via:
aws lambda invoke --endpoint http://localhost:9001 --no-sign-request --function-name deno-func --payload '{}' output.json
and got error:
aws lambda invoke --endpoint http://localhost:9001 --no-sign-request --function-name deno-func --payload '{}' output.json
Please see the example in the README: https://github.com/lambci/docker-lambda#running-in-stay-open-api-mode
You need to let docker know what ports you want to expose (eg, -p 9001:9001
)
:(, thanks very much,
xlink to https://github.com/hayd/deno-lambda/issues/81#issuecomment-635763562
Lambda layers mount at /opt and handler code mounts at /var/task
Is key: you need the bin/deno binary mounted to /opt.
Hello, I tried to run custom runtime with
Deno
(https://github.com/hayd/deno-lambda/releases/download/1.0.2/deno-lambda-example.zip), while failed saying the below errors: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
I feel PATH, and current directory are correct, and
deno
is under/var/task/bin
directory Any idea why it happens?