Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RIE instructions missing #659

Open
alexanderankin opened this issue Oct 8, 2023 · 0 comments
Open

RIE instructions missing #659

alexanderankin opened this issue Oct 8, 2023 · 0 comments

Comments

@alexanderankin
Copy link

can you please add somewhere that the command to test must include (unlike "normal" lambda runtimes?) a body like so:

{
    "resource": "/",
    "path": "/",
    "httpMethod": "GET",
    "requestContext": {
        "resourcePath": "/",
        "httpMethod": "GET",
        "path": "/Prod/",
        // ...
    },
    // ....
}

e.g.:

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"requestContext": {}, "path": "/", "httpMethod": "GET"}'
rest of post

amazon claims that testing with the Runtime-Interface-Emulator (aka rie) should be possible by performing these steps:

https://github.com/aws/aws-lambda-nodejs-runtime-interface-client#local-testing

  1. install rie:
mkdir -p ~/.aws-lambda-rie && \
    curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \
    chmod +x ~/.aws-lambda-rie/aws-lambda-rie
  1. run app:
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
    --entrypoint /aws-lambda/aws-lambda-rie \
    myfunction:latest \
        /usr/local/bin/npx aws-lambda-ric app.handler
  1. post an event:
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

this does not work with this package, because some additional fields must be present.

other commands i tried:

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"requestContext": {}, "path": "/"}'

and then finally after looking here https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html:

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"requestContext": {}, "path": "/", "httpMethod": "GET"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant