Question

Golang - Spaces - noSuchBucket Error for copyObject bucket while putObject with the same bucket works

Posted June 21, 2021 72 views
GoDigitalOcean Spaces

Hello,

I am trying to make a copy of a file in Spaces

If putting in a new file with

bucket := "someBucket"

object := s3.PutObjectInput{
    Bucket:      aws.String(bucket),
    Key:         aws.String(key),
        ...
    }

it works, but if copying

bucket := "someBucket"

cpObj := s3.CopyObjectInput{
        Bucket:     aws.String(bucket),
        CopySource: aws.String(fromPath),
        Key:        aws.String(toPath),
    }

_, err := cl.CopyObject(&cpObj)
log.Println("Error", err)

it logs:

Error NoSuchBucket

It does not make any sense to me. Any help appreciated. :)

Mila

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!