-
Notifications
You must be signed in to change notification settings - Fork 101
explicit region_name in boto3 client init #130
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
Conversation
May you address the |
I've done that now - the code still fails the pytest though, as "https://your-bucket-endpoint-url.com'" doesn't contain a valid s3 compliant URL and so there's no region to be found and submitted in the boto3 client initialisation. I don't know if it's possible to change pytest so that it submits a compliant dummy url: https://testbucket.s3.testregion.amazonaws.com or something? |
Thank you for the correction, I see that I need to add the trigger to run that workflow on PRs as well. Do you have screenshots of the exact test error? |
Oh, I see, it is just the assertion test that needs to be updated to include "region_name=None" for the expected call. |
Is that something I should be doing? Sorry I'm a bit new to all this! |
Feel free to take a crack at it; otherwise, I'd be glad to take the PR over the finish line. Your contribution is already greatly appreciated! In the rp_upload test file there should be something like "assert called with" and then has the client input but will be missing the |
I've made those changes now, but not sure how to get that other end-to-end test to run - the error coming up is about docker usernames: |
That last test needs to be run from our account. PR looks good; thanks for the submission! |
To make sure I'm targeting the right region (specifically, eu-west-2), I've explicitly set the
region_name
parameter during the boto3 client initialization. Without this setting, there's a risk the client could default tous-east-1
or pick up a region from system AWS configuration files.By being explicit about the
region_name
, I've ensured the client recognizes the intended region, which should lead to the generation of presigned URLs that correctly match the desired AWS zone. I've tried to read the region from the bucket URL and tried to do that for a variety of common providers. It could also be addressed via an environment variable if that brings it inline better with your design philosophyThis PR addresses #126