aws / aws-sdk-net

The official AWS SDK for .NET. For more information on the AWS SDK for .NET, see our web site:
http://aws.amazon.com/sdkfornet/
Apache License 2.0
2.05k stars 852 forks source link

AmazonPinpointSMSVoice SendVoiceMessageAsync is using wrong Content Type #1215

Closed BradVog closed 5 years ago

BradVog commented 5 years ago

I'm getting the error Unsupported Media Type when calling the SendVoiceMessageAsync function on AmazonPinpointSMSVoiceClient. After some searching, I found someone else with the same problem who seemed to do some digging on what the underlying problem is:

https://forums.aws.amazon.com/thread.jspa?messageID=887082

Expected Behavior

SendVoiceMessageAsync should return a Success status code, or a status code defined in the API.

Current Behavior

AmazonPinpointSMSVoiceException is thrown with the message: Unsupported Media Type

Possible Solution

The beleive following line should be application/json, or the server should support application/x-amz-json-1.1 https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Services/PinpointSMSVoice/Generated/Model/Internal/MarshallTransformations/SendVoiceMessageRequestMarshaller.cs#L58

Steps to Reproduce (for bugs)

Context

This is critical blocking bug for me since this failure seems to be out of my control. Any workarounds would be very helpful

Your Environment

.NET Core Info

.NET Core SDK (reflecting any global.json): Version: 2.2.200-preview-009804 Commit: 8e586b8a98

Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.200-preview-009804\

Host (useful for support): Version: 2.2.1 Commit: 878dd11e62

.NET Core SDKs installed: 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.302 [C:\Program Files\dotnet\sdk] 2.1.402 [C:\Program Files\dotnet\sdk] 2.1.403 [C:\Program Files\dotnet\sdk] 2.1.500 [C:\Program Files\dotnet\sdk] 2.1.600-preview-009472 [C:\Program Files\dotnet\sdk] 2.1.600-preview-009497 [C:\Program Files\dotnet\sdk] 2.2.100-preview2-009404 [C:\Program Files\dotnet\sdk] 2.2.100-preview3-009430 [C:\Program Files\dotnet\sdk] 2.2.100 [C:\Program Files\dotnet\sdk] 2.2.200-preview-009748 [C:\Program Files\dotnet\sdk] 2.2.200-preview-009804 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.0-preview2-35157 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.0-preview3-35497 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.0-preview2-35157 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.0-preview3-35497 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.0-preview2-26905-02 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.0-preview3-27014-02 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

netcoreapp2.2 true $(NoWarn);1591 1.0.166 VOG Backend Core Core features and boilerplate code for backend development Attempt to optimize CrudRepository true True # bin\Debug\netcoreapp2.2\VOGBackend.Core.xml bin\Release\netcoreapp2.2\VOGBackend.Core.xml
BradVog commented 5 years ago

Followup: I pulled the code and changed application/x-amz-json-1.1 to application/json it fixed the issue for me. Obviously this code seems generated from an external source otherwise I would submit a pull request.

danielmarbach commented 5 years ago

If I'm not mistaken the schemas are here https://github.com/aws/aws-sdk-net/tree/master/generator/ServiceModels/pinpoint. So if you find the json schema that is used for that call you can tweak that schema and then run the generator. This fixes then the generated code

normj commented 5 years ago

Thanks for reporting the issue. I'll take a look into the issue.

normj commented 5 years ago

We have identified the bug in the code generator that is causing the incorrect content-type being set. The change is going to affect more than just this service call so it is going to take a bit to test the fix.

sstevenkang commented 5 years ago

This is fixed in https://github.com/aws/aws-sdk-net/commit/aa7b4e61b0030dcfcd924a8f1368608dcaf3fbb8 with a new releases of AWSSDK.Pinpoint 3.3.13.1 and AWSSDK.Core 3.3.32 Please let us know if the issue persists.