Acknowledgements
Describe the bug
A DeserializationError is returned when using a static credentials provider created with a static credentials that has a trailing space or new line in the SecretAccessKey value
DeserializationError: "failed to decode response body, invalid character '\\n' in string literal"
Regression Issue
Expected Behavior
An error message relating to the SecretAccessKey being invalid is returned
Current Behavior
A DeserializationError error is returned: "failed to decode response body, invalid character '\\n' in string literal"
Reproduction Steps
- Create a new credentials provider using
credentials.NewStaticCredentialsProvider with the SecretAccessKey value containing a trailing space or new line.
- Create an
aws.config value as normal using the credentials provider created in the above step
- Create an
inspector2.Client with the NewFromConfig method
- Use the
inspector2.Client.ListFindings method
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2 v1.41.1
github.com/aws/aws-sdk-go-v2/service/inspector2 v1.46.2
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect
github.com/aws/smithy-go v1.24.0
Compiler and Version used
go version go1.25.5 darwin/arm64
Operating System and version
macOS Tahoe 26.2
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...)Describe the bug
A
DeserializationErroris returned when using a static credentials provider created with a static credentials that has a trailing space or new line in theSecretAccessKeyvalueDeserializationError:"failed to decode response body, invalid character '\\n' in string literal"Regression Issue
Expected Behavior
An error message relating to the
SecretAccessKeybeing invalid is returnedCurrent Behavior
A
DeserializationErrorerror is returned:"failed to decode response body, invalid character '\\n' in string literal"Reproduction Steps
credentials.NewStaticCredentialsProviderwith theSecretAccessKeyvalue containing a trailing space or new line.aws.configvalue as normal using the credentials provider created in the above stepinspector2.Clientwith theNewFromConfigmethodinspector2.Client.ListFindingsmethodPossible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go version go1.25.5 darwin/arm64
Operating System and version
macOS Tahoe 26.2