Giter Club home page Giter Club logo

Comments (8)

mullermp avatar mullermp commented on September 22, 2024 1

Checking the internal ticket I created, it looks like estimated fix is this month some time. I'll check in and see the progress. In the mean time, you can use the monkey patch method above.

from aws-sdk-ruby.

mullermp avatar mullermp commented on September 22, 2024

Thanks for the detailed report. I agree it's broken - and you are possibly the first one to find it (many customers still use SES v1). We deliberately blocked Content-Length for GET methods because it is ambiguous / un-defined / not intended and is actually not recommended in our AWS API standards. But alas, here we are, and there are some teams/services where this slipped in, and even did so prior to that guidance.

Let me follow up with the team to see if we should write in a hack or if we can get the SES team to fix their modeling. We are generating a default body of {} by inspecting the model - it checks for any shape/member that does not have a location (no location = body). The other members in this operation are bound to the URI or a query string, but this one is not, so it creates the body, but then the corresponding Content-Length is not provided.

In the mean time, you can certainly monkey patch METHODS_WITHOUT_BODY to remove GET.

from aws-sdk-ruby.

mbland avatar mbland commented on September 22, 2024

@mullermp Thanks for following up so quickly!

BTW, I'm not yet following "We are generating a default body of {} by inspecting the model..." explanation exactly yet, and I have a question about "The other members in this operation are bound to the URI or a query string..."

In my original code, I was also passing a Filter value. Should Filter be bound to a query string? Because in my experiment below, all the other request options are bound to the URI or the query string, but Filter always shows up as a JSON body.

If I update the script as follows (looking more like the list_contacts API documentation)...

#!/usr/bin/env ruby

require 'aws-sdk-sesv2'

options = {
  contact_list_name: "TestList",
  filter: {
    filtered_status: "OPT_IN",
    topic_filter: {
      topic_name: "TestTopic",
      use_default_if_preference_unavailable: true,
    },
  },
  page_size: 1,
  next_token: "NextToken",
}

Aws::SESV2::Client.new.list_contacts(options).each do |r|
  r.contacts.each {|c| puts c.to_s}
end

...and hack this into net/http/generic_request.rb:

def send_request_with_body_stream(sock, ver, path, f)                         
  puts "PATH: #{path}\nBODY:\n#{f.string}"

...the script produces the following output before the stack trace:

PATH: /v2/email/contact-lists/TestList/contacts?PageSize=1&NextToken=NextToken                                                                                   
BODY:                                                                                                                                                            
{"Filter":{"FilteredStatus":"OPT_IN","TopicFilter":{"TopicName":"TestTopic","UseDefaultIfPreferenceUnavailable":true}}}

from aws-sdk-ruby.

mullermp avatar mullermp commented on September 22, 2024

The Ruby SDK is placing Filter in the body correctly because that's what the model says to do. But it is a GET operation with a modeled body, which is incorrect. The Ruby SDK is correctly inspecting the model and seeing at least one member (Filter) and generating a default body {} when Filter is not provided (logic is here), because AWS rest-json protocol requires at least an empty object. When Filter is provided, it's in the body, as you have seen. Whether Filter should be a query string, header, etc, is up to the service/modeling - it definitely should NOT be on the body unless this method is a POST/PUT.

I talked with other teams on this and apparently this is a known issue. The operation is just broken for Java SDK, .NET, and others. After talking with our leadership here, I am going to re-raise this to the SES team with high severity. The service model change is not trivial. To unblock you, I recommend monkey patching METHODS_WITHOUT_BODY (re-define it) without GET. Ruby will allow GET with body, but Java does not for example.

from aws-sdk-ruby.

mbland avatar mbland commented on September 22, 2024

That makes perfect sense now, thanks! And thanks for taking the issue up the chain.

from aws-sdk-ruby.

khash avatar khash commented on September 22, 2024

Has there been any progress on this? This is quite a big deal if anyone is thinking about using the SDK for synching a contact list (ie remove the deleted contacts from a list would require fetching the contacts within a list first).

Are there any other ways for synching a contact list? Otherwise, I guess the only option is to write this method outside of the SDK for now using HTTParty or Faraday directly.

from aws-sdk-ruby.

chuckmitchell avatar chuckmitchell commented on September 22, 2024

@mullermp thanks for the explanation, I just ran into this. Any news?

from aws-sdk-ruby.

mullermp avatar mullermp commented on September 22, 2024

None yet, annoyingly. I am going to make noise on this one, because it's been lingering again for too long.

from aws-sdk-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.