-
Notifications
You must be signed in to change notification settings - Fork 106
sam local start-api
broken due to missing lambda-runtime-invoked-function-arn
header since v1.13.0
#11
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
Comments
sam local
broken due to missing lambda-runtime-invoked-function-arn
header since v1.13.0sam start-api
broken due to missing lambda-runtime-invoked-function-arn
header since v1.13.0
sam start-api
broken due to missing lambda-runtime-invoked-function-arn
header since v1.13.0sam local start-api
broken due to missing lambda-runtime-invoked-function-arn
header since v1.13.0
@ramosbugs SAM CLI is no integrated with Moving over to the |
fake ARN sounds great, thanks! |
@jfuss I have been getting a similar error using the public.ecr.aws/lambda/provided:al2 docker image. It seems the aws-lambda-rie is not passing It would be best to just return default mock values from aws-lambda-rie because other Lambda runtimes like like https://github.com/swift-server/swift-aws-lambda-runtime expect the following to return or they throw errors:
|
Having the same problem as @Alappin We are trying to get away from third-party libraries and would love if this worked out of the box so we can use the aws supported and maintained version :) |
Having the same issue. Is there a work-around? Also what's weird is the Python handlers don't even blink at this missing header but the example Rust handler bails. |
@sj4nes if you’re doing a Rust handler the newer lamedh crates have worked fine for me (https://github.com/lamedh-dev/aws-lambda-rust-runtime). I also had luck pinning sam-cli to 1.12.0 with the official runtime crates. |
This was fixed as part of #23, but it appears that a new version of the RIE was never published to https://github.com/aws/aws-lambda-runtime-interface-emulator/releases. The available releases still show v1.0, which was released on Nov 30, 2020 and predates the actual fix for the missing header in the emulator. As a temporary work around, I had to compile the RIE binary from the default branch and manually insert the RIE into our lambda container images following the documentation from https://docs.aws.amazon.com/lambda/latest/dg/images-test.html#images-test-alternative. My projects are using the It would be awesome if a new version could be published and made available as part of the base image from AWS. Currently, the official rust runtime from AWS panics when running locally due to the missing header (awslabs/aws-lambda-rust-runtime#313). |
I'm experiencing a similar problem when the X-Amzn-Trace-Id header is not present. Panics with: thread 'main' panicked at 'no entry found for key "lambda-runtime-trace-id"', /Users/felix.marezki/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc6299db9ec823/lambda_runtime-0.3.0/src/types.rs:135:28 But maybe there that is more of an issue for the lambda_runtime!? |
I second all the other comments - please release new versions of |
👋 just noting a suggested fix to the rust runtime: awslabs/aws-lambda-rust-runtime#332 |
Description:
Up to version v1.12.0, I was able to test my API Gateway REST API using
sam local start-api
with a Lambda built on top of https://github.com/awslabs/aws-lambda-rust-runtime. However, this functionality stopped working in v1.13.0 due to the missinglambda-runtime-invoked-function-arn
header that the runtime expects:The code runs fine on production AWS Lambda, so I believe this is a bug in the SAM CLI's local emulation, not in the Rust runtime. For reference, the runtime expects several headers to be provided by Lambda:
https://github.com/awslabs/aws-lambda-rust-runtime/blob/13aa8f01813e6949ca91aedafb286591fdf32217/lambda/src/types.rs#L123-L139
It looks like aws/aws-sam-cli#2425 may have introduced this regression (cc @sriram-mv). The code that previously set these headers was removed in that PR:
https://github.com/aws/aws-sam-cli/blob/559e4a564ba37906f2081c0de415b39bc9b2c3c1/samcli/local/rapid/init.go#L482-L486
Steps to reproduce:
Use
sam local start-api
to test a REST API locally. In my case, using AWS Labs's Rust runtime.Observed result:
Lambda function panics due to missing headers (the same Lambda works fine on AWS).
Expected result:
Lambda should execute without error.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.13.0 (also tested on 1.13.2 and latestdevelop
HEAD).Add --debug flag to command you are running
The text was updated successfully, but these errors were encountered: