Skip to content

NoneType object has no attribute 'items' #249

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

Closed
ddhanak opened this issue Sep 12, 2022 · 4 comments · Fixed by #259
Closed

NoneType object has no attribute 'items' #249

ddhanak opened this issue Sep 12, 2022 · 4 comments · Fixed by #259

Comments

@ddhanak
Copy link

ddhanak commented Sep 12, 2022

Expected Behavior

Triggering a lambda through an API Gateway without providing headers should not throw an error.

Actual Behavior

There is an error thrown when trying to extract the headers from the context.

Steps to Reproduce the Problem

  1. Send a request using a lambda backed API Gateway endpoint (done through console) without providing headers
  2. Check cloudwatch logs

Specifications

  • Datadog Lambda Layer version: 62
  • Python version: 3.9

Stacktrace

2022-09-12T10:37:18.731-04:00	Traceback (most recent call last):
  2022-09-12T10:37:18.731-04:00	File "/opt/python/lib/python3.9/site-packages/datadog_lambda/wrapper.py", line 167, in _before
  2022-09-12T10:37:18.731-04:00	dd_context, trace_context_source = extract_dd_trace_context(
  2022-09-12T10:37:18.731-04:00
File "/opt/python/lib/python3.9/site-packages/datadog_lambda/tracing.py", line 342, in extract_dd_trace_context
  File "/opt/python/lib/python3.9/site-packages/datadog_lambda/tracing.py", line 342, in extract_dd_trace_context
  2022-09-12T10:37:18.731-04:00	) = extract_context_from_http_event_or_context(event, lambda_context)
  2022-09-12T10:37:18.731-04:00
File "/opt/python/lib/python3.9/site-packages/datadog_lambda/tracing.py", line 178, in extract_context_from_http_event_or_context
  File "/opt/python/lib/python3.9/site-packages/datadog_lambda/tracing.py", line 178, in extract_context_from_http_event_or_context
  2022-09-12T10:37:18.731-04:00	lowercase_headers = {k.lower(): v for k, v in headers.items()}
  2022-09-12T10:37:18.731-04:00	AttributeError: 'NoneType' object has no attribute 'items'
@sfirrin
Copy link
Contributor

sfirrin commented Nov 2, 2022

Thanks a lot for your report @ddhanak, that PR should fix the issue.

I didn't mean to close this until it's released, I'm not able to do the release so my colleague is going to release in the next few hours and I will ping you here and close the issue then.

@sfirrin sfirrin reopened this Nov 2, 2022
@ddhanak
Copy link
Author

ddhanak commented Nov 2, 2022

Awesome @sfirrin !

@sfirrin
Copy link
Contributor

sfirrin commented Nov 7, 2022

Hi @ddhanak, sorry for the delay, we are having an issue creating the release that we are working on resolving now

@sfirrin
Copy link
Contributor

sfirrin commented Nov 7, 2022

@ddhanak it's now released in https://github.com/DataDog/datadog-lambda-python/releases/tag/v64 so I'm going to close this out

Thanks again for opening the issue and please let us know if you're running into anything else

@sfirrin sfirrin closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants