You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How can I test locally using sam local start-lambda with a Rust lambda? #589
I want to do local testing (run this lambda as a server on localhost and make HTTP GET requests to it), so I've tried running this:
$ sam local start-lambda --port 8011 --template ./cdk.out/RustStandaloneStack.template.json
Starting the Local Lambda Service. You can now invoke your Lambda Functions defined in your template through the endpoint.
2023-01-23 11:08:56 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
The server successfully starts up, but I can't figure out what sort of request to send it. It just responds with a 404 no matter what path or headers I specify to it with my GET requests.
By comparison, one-off invocations work just fine:
# ./tests/sample.json is an event matching the same format of the one seen in this issue comment:# https://github.com/awslabs/aws-lambda-rust-runtime/issues/365#issue-1054795934
$ sam local invoke MyRustLambda --event ./tests/sample.json --template ./cdk.out/RustStandaloneStack.template.json
Requesting using the exact same path and headers specified in my ./tests/sample.json file, I am met with a 404 response.
This feels like an underdocumented area in the SAM/CDK/Lambda docs so any pointers would be greatly appreciated.
Activity
calavera commentedon Jan 23, 2023
I'm not familiar with
sam local, but these links might help you:https://www.cargo-lambda.info/commands/watch.html
https://www.cargo-lambda.info/commands/invoke.html
https://www.cargo-lambda.info/guide/screencasts.html#cargo-lambda-watch