Skip to content

Error on SES SendRawEmail without Destinations specified #6287

@mmastika

Description

@mmastika

Hi there,

We're in the process of isolating our build to use LocalStack. In the process we stumbled on an issue where LocalStack would fail with 500 error on SendRawEmail.

We're able to isolate the issue to what appears to be a LocalStack issue. According to a post on StackOverflow, for us to use SendRawEmail and to specify TO, CC and BCC, we must specify it on the on the message/email header, then we MUST not set destinations. This works as expected when we have AWS to test as well as in Production. LocalStack however, produces the following error:

2022-06-16T08:26:27.149:WARNING:localstack.utils.server.http2_server: Error in proxy handler for request POST http://localhost:4566/: object of type 'NoneType' has no len() Traceback (most recent call last):
  File "/opt/code/localstack/localstack/utils/server/http2_server.py", line 185, in index
    result = await run_sync(handler, request, data)
  File "/opt/code/localstack/localstack/utils/asyncio.py", line 85, in run_sync
    return await loop.run_in_executor(thread_pool, copy_context().run, func_wrapped)
  File "/opt/code/localstack/localstack/utils/threads.py", line 39, in run
    result = self.func(self.params, **kwargs)
  File "/opt/code/localstack/localstack/utils/asyncio.py", line 30, in _run
    return fn(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 993, in handler
    return modify_and_forward(
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 534, in wrapper
    value = func(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 614, in modify_and_forward
    listener_result = listener.forward_request(
  File "/opt/code/localstack/localstack/services/edge.py", line 170, in forward_request
    result = do_forward_request(api, method, path, data, headers, port=port)
  File "/opt/code/localstack/localstack/services/edge.py", line 225, in do_forward_request
    result = do_forward_request_inmem(api, method, path, data, headers, port=port)
  File "/opt/code/localstack/localstack/services/edge.py", line 249, in do_forward_request_inmem
    response = modify_and_forward(
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 534, in wrapper
    value = func(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 614, in modify_and_forward
    listener_result = listener.forward_request(
  File "/opt/code/localstack/localstack/http/adapters.py", line 51, in forward_request
    response = self.request(request)
  File "/opt/code/localstack/localstack/aws/proxy.py", line 43, in request
    return self.skeleton.invoke(context)
  File "/opt/code/localstack/localstack/aws/skeleton.py", line 153, in invoke
    return self.dispatch_request(context, instance)
  File "/opt/code/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request
    result = handler(context, instance) or {}
  File "/opt/code/localstack/localstack/aws/forwarder.py", line 57, in _call
    return handler(context, req)
  File "/opt/code/localstack/localstack/aws/skeleton.py", line 117, in __call__
    return self.fn(*args, **kwargs)
  File "/opt/code/localstack/localstack/aws/api/core.py", line 99, in operation_marker
    return fn(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/ses/provider.py", line 261, in send_raw_email
    message = ses_backend.send_raw_email(source, destinations, raw_data, context.region)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/ses/models.py", line 259, in send_raw_email
    recipient_count = len(destinations)
TypeError: object of type 'NoneType' has no len()

Adding a valid email address(es) to the destination will not result in the error from LocalStack (our tests will pass). There doesn't seem a way for us to use the SendRawEmailRequest destinations field to specify CC or BCC fields (which we require).

We're using the latest localstack docker image, on Java 14 and we're using java aws SDK 1.11.277.

Please help.

Metadata

Metadata

Labels

aws:sesAmazon Simple Email Servicegood first issueGood item to work on for newcomersstatus: resolved/fixedResolved with a fix or an implementationtype: bugBug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions