Using deno-lambda for AWS SAM
I'm having issues trying to run deno-lambda (https://github.com/hayd/deno-lambda) locally. (I haven't tried running it on AWS for real yet.)
Init failed error=fork/exec /var/task/bootstrap: no such file or directory InvokeID=My main module filename is
main.ts
and it exports a handler
function which I think should work. Here is how I build and run everything:
sam validate
rm -rf .deno_dir
DENO_DIR=.deno_dir deno cache main.ts
cp -R .deno_dir/gen/file/"$PWD"/ .deno_dir/LAMBDA_TASK_ROOT
sam local invoke MyLittleFunction --event events/log-0001.json
sam validate
rm -rf .deno_dir
DENO_DIR=.deno_dir deno cache main.ts
cp -R .deno_dir/gen/file/"$PWD"/ .deno_dir/LAMBDA_TASK_ROOT
sam local invoke MyLittleFunction --event events/log-0001.json
1 Reply
Here's my
Here's the full output of
template.yaml
:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
Deno:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno
SemanticVersion: '1.32.5'
MyLittleFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: '.'
Handler: main.handler
Runtime: provided.al2
Layers:
- Fn::GetAtt:
- Deno
- Outputs.LayerArn
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
Deno:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno
SemanticVersion: '1.32.5'
MyLittleFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: '.'
Handler: main.handler
Runtime: provided.al2
Layers:
- Fn::GetAtt:
- Deno
- Outputs.LayerArn
sam local
:
2023-05-05 10:10:03 Requesting to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo...
2023-05-05 10:10:04 Requested to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo.
2023-05-05 10:10:04 Requesting to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo...
2023-05-05 10:10:05 Requested to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo.
Invoking main.handler (provided.al2)
Local image is up-to-date
Using local image: public.ecr.aws/lambda/provided:al2-rapid-x86_64.
Mounting /Users/foo/bar/baz/my-project-root as /var/task:ro,delegated, inside runtime container
START RequestId: 4adba65b-7c06-43c7-9bb6-655edd1990e6 Version: $LATEST
05 May 2023 08:10:08,595 [ERROR] (rapid) Init failed error=fork/exec /var/task/bootstrap: no such file or directory InvokeID=
Function 'MyLittleFunction' timed out after 3 seconds
No response from invoke container for MyLittleFunction
2023-05-05 10:10:03 Requesting to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo...
2023-05-05 10:10:04 Requested to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo.
2023-05-05 10:10:04 Requesting to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo...
2023-05-05 10:10:05 Requested to create CFN template arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno/1.32.5 in serverless application repo.
Invoking main.handler (provided.al2)
Local image is up-to-date
Using local image: public.ecr.aws/lambda/provided:al2-rapid-x86_64.
Mounting /Users/foo/bar/baz/my-project-root as /var/task:ro,delegated, inside runtime container
START RequestId: 4adba65b-7c06-43c7-9bb6-655edd1990e6 Version: $LATEST
05 May 2023 08:10:08,595 [ERROR] (rapid) Init failed error=fork/exec /var/task/bootstrap: no such file or directory InvokeID=
Function 'MyLittleFunction' timed out after 3 seconds
No response from invoke container for MyLittleFunction