Comments (8)
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.
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.
@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.
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.
That makes perfect sense now, thanks! And thanks for taking the issue up the chain.
from aws-sdk-ruby.
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.
@mullermp thanks for the explanation, I just ran into this. Any news?
from aws-sdk-ruby.
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)
- [SES] Custom verification email template no redirect HOT 9
- SQS QueuePoller sometimes returns dupe messages, raises BatchEntryIdsNotDistinct HOT 1
- DynamoDB #query method returns response with items = nil HOT 18
- Aws::S3::PresignedPost does not support tagging field HOT 3
- Multipart copy for Glacier
- CognitoIdentityCredentials is not including the logins set when getting credentials, making all requests unauthenticated HOT 5
- `Aws::BedrockRuntime::Types::<X>` doesn't have `event_type=` HOT 3
- Listing shared RDS Clusters raises an ArgumentError HOT 6
- Errors downloading files from s3 are propagated to incorrect thread HOT 8
- aws-sdk-sqs raises NoMethodError when messages not found HOT 14
- Generate RBS HOT 15
- aws-partitions 1.856.0 no longer be found in that source HOT 8
- aws-sigv4/eventstream released a minor version bump after removing support for Ruby 2.3/2.4 HOT 5
- [aws-sdk-sqs] Aws::SQS::Types::SendMessageBatchResult#failed returns nil HOT 8
- aws-sdk-sesv2 API :next_token Symbol key literal doesn't work as expected (but String key does) HOT 4
- S3 Control Client - Unable to Parse URI HOT 6
- AWS Bedrock ReadTimeout NetworkingError TCPSocket closed HOT 3
- Tagging resources seems to be broken HOT 6
- Aws::Errors::MissingCredentialsError exception in ECS when using TaskRoleArn HOT 10
- Gem displays deprecation warning in ruby 3.3 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-ruby.