Skip to content
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

The parameter for Object Data should be "body" not "Body". #667

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joaomarceloalencar
Copy link

Using "Body" as optional parameter creates empty object. "body" should be used.

This code:

using AWS: @service
@service S3

function upload_file_to_s3(bucket_name, file_path)
    file_name = basename(file_path)
    open(file_path, "r") do file
        S3.put_object(bucket_name, file_name, Dict("Body" => read(file, String)))
    end
    println("File $file_name uploaded to $bucket_name.")
end

template_file="./README.md"
bucket_name="my-unique-bucket-name"
upload_file_to_s3(bucket_name, template_file)

Creates an empty object. If you use "body" instead of "Body", it creates the object with the expected content. The documentation uses "Body".

Using "Body" as optional parameter creates empty object. "body" should be used.
@ararslan
Copy link
Member

ararslan commented Feb 2, 2024

Hi @joaomarceloalencar, thanks for the contribution! The documentation your PR is editing is automatically generated based on the official AWS documentation, so your change will be overwritten the next time things are updated. As for why you're seeing differences in behavior between Body and body, have you by chance changed the backend in use? If I recall, there is some difference in behavior with regards to the case sensitivity of request parameters between the HTTP.jl and Downloads.jl backends.

@joaomarceloalencar
Copy link
Author

Hi @ararslan

Thank you for your reply. Yeah, I really thought that this documentation was automatically generated. But I thought that the PR was the best way show exactly what confused me when using AWS.jl. I was kind of lost trying to make it work, then someone at Reddit help me out. It is a small thing, but very annoying.

Regarding the backend, all I did was pkg.add(AWS) on Ubuntu 22.04 with Julia 1.10.0. How can I switch between HTTP.jl and Download.jl? Is there a way to AWS.jl pick a backend that agrees with the documentation?

Best Regards.

@mattBrzezinski
Copy link
Member

Unfortunately this is generated from aws-sdk-js which,

Does not specify capitalization anywhere :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants