aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.68k stars 650 forks source link

`connect` service `ContactFlow.IsDefault` serialized incorrectly #2909

Open ewbankkit opened 1 week ago

ewbankkit commented 1 week ago

Acknowledgements

Describe the bug

The field IsDefault (added in connect@v1.116.0, Release 2024-11-18) in the connect service's ContactFlow struct has Go type bool: https://github.com/aws/aws-sdk-go-v2/blob/18fea5d7df1f6a923b62e7d3d38663ff61814878/service/connect/types/types.go#L1008-L1065. The upstream service is incorrectly serializing this field as a string

  http.response.body=
  | {
  |   "ContactFlow" : {
  |     "Arn" : "arn:aws:connect:us-west-2:123456789012:instance/5d367605-5d5b-4d98-a442-fe88e573aaaa/contact-flow/2f3b8896-ee32-48d5-981b-e287673e8f4f",
  |     "Id" : "2f3b8896-ee32-48d5-981b-e287673e8f4f",
  |     "IsDefault" : "false",
  |     "Name" : "resource-test-terraform-7075749418873109470",
  |     "Type" : "CONTACT_FLOW",
  |     "State" : "ACTIVE",
  |     "Status" : "PUBLISHED",
  |     "LastModifiedRegion" : "us-west-2",
  |     "LastModifiedTime" : 1.73229019499E9,
  |     "FlowContentSha256" : "9b5906e4b563c7d71dadd8f911d8c88db02ccd38a92edd17b55f92e302c6afaf",
  |     "Description" : "Created",
  |     "Content" : "    {\n\t\t\"Version\": \"2019-10-30\",\n\t\t\"StartAction\": \"12345678-1234-1234-1234-123456789012\",\n\t\t\"Actions\": [\n\t\t\t{\n\t\t\t\t\"Identifier\": \"12345678-1234-1234-1234-123456789012\",\n\t\t\t\t\"Type\": \"MessageParticipant\",\n\t\t\t\t\"Transitions\": {\n\t\t\t\t\t\"NextAction\": \"abcdef-abcd-abcd-abcd-abcdefghijkl\",\n\t\t\t\t\t\"Errors\": [],\n\t\t\t\t\t\"Conditions\": []\n\t\t\t\t},\n\t\t\t\t\"Parameters\": {\n\t\t\t\t\t\"Text\": \"Created\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"Identifier\": \"abcdef-abcd-abcd-abcd-abcdefghijkl\",\n\t\t\t\t\"Type\": \"DisconnectParticipant\",\n\t\t\t\t\"Transitions\": {},\n\t\t\t\t\"Parameters\": {}\n\t\t\t}\n\t\t]\n    }\n",
  |     "Tags" : {
  |       "Method" : "Created",
  |       "Name" : "Test Contact Flow"
  |     }
  |   }
  | }

, causing runtime errors:

deserialization failed, failed to decode response body with invalid JSON, expected Boolean to be of type *bool, got string instead

See https://github.com/hashicorp/terraform-provider-aws/issues/40267.

Regression Issue

Expected Behavior

The DescribeContactFlow API call should succeed with the correct value for IsDefault returned.

Current Behavior

Runtime deserialization error.

Reproduction Steps

    input := &connect.DescribeContactFlowInput{
        ContactFlowId: aws.String(contactFlowID),
        InstanceId:    aws.String(instanceID),
    }

    output, err := conn.DescribeContactFlow(ctx, input)

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

% grep connect go.mod
    github.com/aws/aws-sdk-go-v2/service/codeconnections v1.5.6
    github.com/aws/aws-sdk-go-v2/service/codestarconnections v1.29.6
    github.com/aws/aws-sdk-go-v2/service/connect v1.116.0
    github.com/aws/aws-sdk-go-v2/service/connectcases v1.21.6
    github.com/aws/aws-sdk-go-v2/service/directconnect v1.29.6
    github.com/aws/aws-sdk-go-v2/service/kafkaconnect v1.21.6
    github.com/aws/aws-sdk-go-v2/service/mediaconnect v1.35.6
    github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.9.6

Compiler and Version used

go 1.23.2

Operating System and version

macos

RanVaknin commented 6 days ago

Hi @ewbankkit ,

Thanks again for the speedy report. I have engaged with the Connect team and they are working on a way to mitigate this ASAP.

All the best, Ran~