risor
risor copied to clipboard
AWS S3 put_object results in a "cannot unmarshal string into Go struct" error
Hi,
I'm trying out the AWS S3 client for Risor, and I'm finding that putting an object using put_object
would fail with the following error:
json: cannot unmarshal string into Go struct field PutObjectInput.Body of type io.Reader
Here's an sample script of what I'm trying to do:
s3 := aws.client("s3")
func upload_file_to_s3(file, key) {
bts := os.read_file(file)
s3.put_object({
Bucket: "my-bucket",
Key: key,
Body: bts,
})
}
upload_file_to_s3("my-file.txt", "/object/path.txt")
Using os.open()
in place of os.read_file
would also produce the same error.
I'd imagine it may have something to with how the parameters are converted to the AWS types. These aren't large files so if you know of an alternative field to Body
I can use instead, that would work for ne.