-
Notifications
You must be signed in to change notification settings - Fork 45
Non-object events are not handled #232
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
Thanks for reaching out @grahamrp - I'll take a look and get back to you. |
Hey @grahamrp - I've fixed this specific issue in #233 and ran a few sanity checks and integration tests, but I suspect that there may be more latent issues. Call it a gut feeling. I plan to add new integration tests to cover this use case more fully, but for now the units do cover this. Anyway, thanks again for reaching out, I'll update this issue when I release a new version of this library. Please do reach back out if you run into more issues! |
That was fast, thanks @astuyve! |
Happy to help, this was released in version 3.60 of this library (layer version 60) https://github.com/DataDog/datadog-lambda-python/releases/tag/v60 |
Uh oh!
There was an error while loading. Please reload this page.
Expected Behavior
When a lambda is invoked with an event that is not an object (e.g. an array or value type) the instrumentation should handle this case and continue to function as normal.
Actual Behavior
Datadog wrapper fails with
TypeError: argument of type 'NoneType' is not iterable
(when "null" is sent as the Payload) orTypeError: argument of type 'int' is not iterable
(when an integer is sent as the Payload). No logs are sent to Datadog.Steps to Reproduce the Problem
lambda_client
with credentialslambda_client.invoke(FunctionName="foo", InvocationType="RequestResponse", Payload=json.dumps(1))
or json.dumps(None), or any other non-object json.Specifications
Stacktrace
The reason I think this is a bug is that the AWS Lambda documentation mentions support for non-object payloads:
I think what is happening is
extract_dd_trace_context
is assuming a deserialised json object at tracing.py#L335elif "headers" in event:
.When the event is not a deserialised object (i.e. not a dict) the
in
operator will either fail, or result in strange behaviour, for example in a case where a string or array sent in the payload happens to contain the sequenceheaders
.I think issue #225 stems from a similar situation.
The text was updated successfully, but these errors were encountered: