Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

apigateway_listener - TypeError: 'NoneType' object is not iterable #2055

@llatinov

Description

@llatinov

Serverless lambda connected to API Gateway is giving 502 Bad Gateway.

Steps to reproduce:

  1. Clone: https://github.com/llatinov/aws.examples.csharp
  2. Install dotnet SDK 2.1 and 3.1
  3. Install: dotnet tool install -g Amazon.Lambda.Tools
  4. Run ./local-deploy-serverless.sh
  5. Send request to API gateway (replace PROPER_GUID with proper serverless URL)
curl --location --request POST 'http://localhost:4567/restapis/PROPER_GUID/local/_user_request_/actors/search' \
--header 'Content-Type: application/json' \
--header 'x-api-key: TEqfCnmXePaltIHHSdnQm6L578MSO6cd1buhgVkt' \
--header 'Authorization: Bearer validToken' \
--data-raw '{
    "FirstName": "Bruce",
    "LastName": "Willis"
}'

Actual behaviour:
Error is thrown:

localstack_main | 2020-02-16T13:50:11:ERROR:localstack.services.generic_proxy: Error forwarding request: 'NoneType' object is not iterable Traceback (most recent call last):
localstack_main |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 248, in forward
localstack_main |     path=path, data=data, headers=forward_headers)
localstack_main |   File "/opt/code/localstack/localstack/services/apigateway/apigateway_listener.py", line 49, in forward_request
localstack_main |     return invoke_rest_api(api_id, stage, method, relative_path_w_query_params, data, headers, path=path)
localstack_main |   File "/opt/code/localstack/localstack/services/apigateway/apigateway_listener.py", line 256, in invoke_rest_api
localstack_main |     response.headers.update(parsed_result.get('headers', {}))
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.7/_collections_abc.py", line 846, in update
localstack_main |     for key, value in other:
localstack_main | TypeError: 'NoneType' object is not iterable
localstack_main | 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions