-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't create S3 presigned URLs #2874
Comments
I'm sorry this happened. The change looks at credentials expiration and compares it to expires_in. What type of credentials are you using? Are you able to create a presigned url using Presigner class directly instead of using a resource object? |
I'm not able to reproduce this. Using either AssumeRoleCredentials or Static Credentials (access key, etc), I can generate a presigned URL using either of these:
|
Hi @mullermp and thanks for the fast response. Currently I have The same
|
I can take a look at that. Can you confirm through |
Thanks. The following script will print
|
I think I see the issue. The credentials expiration is a "long" instead of a "timestamp" for SSO's RoleCredentials API. This (integer) expiration is set directly in SSOCredentials, instead of a Time. i.e.
I think that we simply need to wrap this with |
Thanks for looking into the issue. I took your suggestion and monkey patched https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sigv4/lib/aws-sigv4/signer.rb#L729 into
With this change the initial script is working as expected. |
|
Forgive me for the ping, but we encountered an issue that rhymed with this one, and @mullermp I just want to say thank you for fixing this so quickly, cleanly, and completely. 👏🏻 👏🏻 |
Describe the bug
Trying to create a presigned URL with
object.presigned_url(:get)
results in aTypeError
.Expected Behavior
The method call should return a valid presigned URL for S3
Current Behavior
A
TypeError
is raised:Reproduction Steps
With the following Gemfile and script, the
TypeError
is raised withbundle install --path vendor/bundle && bundle exec ruby init.rb
Gemfile
Script
Possible Solution
There seems to be a bug in the recently added
presigned_url_expiration
method.Additional Information/Context
Tested with aws-sdk-core (3.174.0), aws-sdk-s3 (1.126.0) and aws-sigv4 (1.5.0) and with these versions the method call works as expected and a valid presigned URL is printed to the console.
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-core (3.176.0), aws-sdk-s3 (1.127.0), aws-sigv4 (1.6.0)
Environment details (Version of Ruby, OS environment)
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin22]
The text was updated successfully, but these errors were encountered: