soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
877 stars 83 forks source link

PutObjectRequest Fails with STS #151

Closed kperson closed 5 years ago

kperson commented 5 years ago

Description When executing a PutObjectRequest I receive the following error:

accessDenied(message: Optional("RequestId: 4059FAA108A45F89, HeadersNotSigned: x-amz-security-token, Message: There were headers present in the request which were not signed, HostId: p013uVEP7DHgqGkbCe/zsjuASVE0b9h9a7Gb37OfnuPmFnNeMZ5VnILzvi9orDLzHtfn1yNEzLA="))

To Reproduce

  1. Execute a put object request in a lambda environment (custom runtime)

Expected behavior

  1. Request succeeds

Setup

Additional context I don't have this issue with SNS or SQS, just S3.

adam-fowler commented 5 years ago

Hi @kperson, Checkout pull request https://github.com/swift-aws/aws-sdk-swift-core/pull/99 By the way how are you passing the session token to the PutObject command? I noticed we don't have a way to pass full Credentials to a service via a function parameter. Are you using the EnvironmentCredentials()?

kperson commented 5 years ago

@adam-fowler I am just allowing for a credential provider to be selected, it would be EnvironementCredential (lambda sets AWS_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN environment variables automatically).

It looks like your PR would resolve the issue! Thank you.