Skip to content

"Runtime.MarshalError" when using custom authorizers on python 3.7 #326

@Wesitos

Description

@Wesitos

Expected Behavior

When invoking a function which returns an "authorizer" like dictionary (has non-falsy "principalId" and "policyDocument" fields) using python3.7, the function should not return an error

Actual Behavior

A "Runtime.MarshalError" is returned because the python 3.7 lambda runtime cannot serialize bytes values (this feature was added in version 3.8)

Steps to Reproduce the Problem

Invoke a lambda function that returns {"principalId" :" ", "policyDocument": " "} using the python3.7 runtime.

You can also clone this serverless project that replicates the bug.

  1. Deploy setting the DATADOG_API_KEY env variable to set a valid api key
  2. invoke the failing function. It'll return an error.

A working function is also provided that workarounds the error by patching the lambda runtime code.

Specifications

  • Datadog Lambda Layer version: v71
  • Python version: 3.7

Stacktrace

No stackTrace

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions