Skip to content

SES | ArgumentError (Content-Length not given and Transfer-Encoding is not `chunked') on calling list contacts api

0

Calling the list_contacts api

credentials = Aws::Credentials.new("AWS-SECRET", "AWS-KEY")
client = Aws::SESV2::Client.new(region: region, credentials: credentials)

client.list_contacts(contact_list_name: "Crm-Subscriber",
                                filter: {
                                  filtered_status: "OPT_IN",
                                  topic_filter: {
                                    topic_name: "Newsletter",
                                    use_default_if_preference_unavailable: false,
                                  },
                                },
                                page_size: 1,
                              })

This is the error I am getting

[Aws::SESV2::Client 0 0.880994 0 retries] list_contacts(contact_list_name:"Crm-Subscriber",filter:{filtered_status:"OPT_IN",topic_filter:{topic_name:"Newsletter",use_default_if_preference_unavailable:false}},page_size:1) ArgumentError Content-Length not given and Transfer-Encoding is not `chunked'

Traceback (most recent call last):
        2: from (irb):16
        1: from (irb):17:in `rescue in irb_binding'
ArgumentError (Content-Length not given and Transfer-Encoding is not `chunked')
1 Answer
1

The error message you received indicates that the request you made did not include a Content-Length header, which is required for HTTP/1.1 requests. Additionally, the Transfer-Encoding header is not set to chunked, which is another way to indicate the length of the content being sent.

To resolve this issue, you can try setting the Content-Length header explicitly in your request. If setting the Content-Length header does not resolve the issue, you can try setting the Transfer-Encoding header to chunked instead.

EXPERT
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.