-
Notifications
You must be signed in to change notification settings - Fork 37
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
Invalid presigned S3 URL #806
Comments
What version of |
|
Sadly I am unable to replicate this error even when I use eu-west-1 s3 bucket: By default aws --profile paws s3 presign "s3://remove-paws-bucket/demo.txt"
#> [1] "https://remove-paws-bucket.s3.us-east-1.amazonaws.com/demo.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=DUMMY-V4%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240719T135640Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=e3b8867f45875a60579e237b7def98b415812a4dac1bddc9f197a3a46a0de27a" library(paws.storage)
client = s3(config(credentials(profile = "paws"), region = "eu-west-1"))
client$generate_presigned_url(
"get_object",
params = list(
Bucket = "remove-paws-bucket", Key = "demo.txt"
),
expires_in = 600
)
#> [1] "https://remove-paws-bucket.s3.eu-west-1.amazonaws.com/demo.txt?AWSAccessKeyId=DUMMY-V1&Expires=1721397953&Signature=14WJMcSJ%2FGOlMGrz%2BgDEG7YC4Jk%3D" Created on 2024-07-19 with reprex v2.1.1 >>> import boto3
...
... client = boto3.Session(profile_name = "paws", region_name = "eu-west-1").client("s3")
...
... client.generate_presigned_url(
... "get_object",
... Params = {
... "Bucket": "remove-paws-bucket", "Key": "demo.txt"
... },
... ExpiresIn = 600
... )
'https://remove-paws-bucket.s3.amazonaws.com/demo.txt?AWSAccessKeyId=DUMMY-V1&Signature=58tc50k1ZTwPYWjb%2FSOV2r1Rc4g%3D&Expires=1721398332' To get the v4 signer you need to specify it in the client, this is similar to library(paws.storage)
client = s3(config(credentials(profile = "paws"), region = "eu-west-1", signature_version = "s3v4"))
client$generate_presigned_url(
"get_object",
params = list(
Bucket= "remove-paws-bucket", Key = "demo.txt"
),
expires_in = 600
)
#> [1] "https://remove-paws-bucket.s3.eu-west-1.amazonaws.com/demo.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=DUMMY-V4%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240719T135553Z&X-Amz-Expires=600&X-Amz-Signature=e835f78aef84924d536612c616f2bfb0b672b09b932dd11aabc3630408fc42df&X-Amz-SignedHeaders=host" Created on 2024-07-19 with reprex v2.1.1 >>> import boto3
>>> import boto3
... from botocore.config import Config
...
... client = boto3.Session(profile_name = "paws", region_name = "eu-west-1").client("s3", config=Config(signature_version='s3v4'))
...
... client.generate_presigned_url(
... "get_object",
... Params = {
... "Bucket": "remove-paws-bucket", "Key": "demo.txt"
... },
... ExpiresIn = 600
... )
'https://remove-paws-bucket.s3.amazonaws.com/demo.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=DUMMY-V4%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240719T141010Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=e40a0ff560bfa5f31629ca11fa7657fc93311efcd648428d3ae0f662c910b9e9' From this you should see that |
Thanks @DyfanJones, that worked! (I did look for signature settings before but I was looking in the wrong place ( |
Hi,
I'm attempting to generate a presigned URL. I've created an s3 object & verified that it works:
I then generated a URL via:
This warning was emitted:
The URL I got was much longer compared to the URL I got from AWS CLI, about twice the number of characters. And while the AWS CLI URL works, I get the following message when I visit the URL generated by the package:
paws.storage version: 0.6.0
Am I doing something wrong or is this a bug?
The text was updated successfully, but these errors were encountered: