Skip to content

[Amazon.Lambda.RuntimeSupport] RIC headers shouldn't be case sensitive #2093

Open
@duncanista

Description

@duncanista

Describe the bug

RIC expects to get case sensitive (capitalized kebab case) headers from the Lambda Runtime API.

internal const string HeaderAwsRequestId = "Lambda-Runtime-Aws-Request-Id";
internal const string HeaderTraceId = "Lambda-Runtime-Trace-Id";
internal const string HeaderClientContext = "Lambda-Runtime-Client-Context";
internal const string HeaderCognitoIdentity = "Lambda-Runtime-Cognito-Identity";
internal const string HeaderDeadlineMs = "Lambda-Runtime-Deadline-Ms";
internal const string HeaderInvokedFunctionArn = "Lambda-Runtime-Invoked-Function-Arn";

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

This should be case insensitive.

It works perfectly for NodeJS

https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/a5ae1c2a92708e81c9df4949c60fd9e1e6e46bed/src/InvokeContext.js#L14-L22

-- edit:

Also works perfectly for Java, Python, and Ruby

Current Behavior

When building a rust Proxy Server for the Lambda Runtime API, I get the following error when working in .NET functions.


Unhandled exception. System.Collections.Generic.KeyNotFoundException: The given key 'Lambda-Runtime-Aws-Request-Id' was not present in the dictionary.
--
  | 2025-06-17T19:10:32.131Z | at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.RuntimeApiHeaders..ctor(Dictionary`2 headers) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/RuntimeApiHeaders.cs:line 32
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.RuntimeApiClient.GetNextInvocationAsync(CancellationToken cancellationToken) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/RuntimeApiClient.cs:line 112
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.LambdaBootstrap.InvokeOnceAsync(CancellationToken cancellationToken) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs:line 261
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.LambdaBootstrap.RunAsync(CancellationToken cancellationToken) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs:line 224
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.RuntimeSupportInitializer.RunLambdaBootstrap() in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/RuntimeSupportInitializer.cs:line 70
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.Program.Main(String[] args) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Program.cs:line 48
  | 2025-06-17T19:10:32.131Z | at Amazon.Lambda.RuntimeSupport.Program.<Main>(String[] args)

Reproduction Steps

Build a Lambda Runtime API proxy in Rust, then just do a bypass and see how it fails for .NET

Possible Solution

Making header lookup case insensitive

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

n/a

Targeted .NET Platform

.NET 6 and .NET 8

Operating System and version

AWS Lambda

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.module/lambda-client-libp2This is a standard priority issuepr/needs-reviewThis PR needs a review from a Member.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions