Report this

What is the reason for this report?

Putting object to Spaces with Access Key gives cert error

Posted on May 11, 2022

I get this error

x509: certificate signed by unknown authority

when I try to put an object to Spaces using access keys in a docker container. I can get files just fine, and I can put files from my local machine (not in a docker container). I’m using the minio package from a golang app. This happens even with ssl=false. Is it looking for a cert only on puts?

Here’s what my code looks like

	endpoint := "sfo3.digitaloceanspaces.com"
	bucket := "mybucket"
	ssl := false
	client, err := minio.New(endpoint, accessKey, secKey, ssl)
	if err != nil {
		fmt.Println(err)
		return nil
	}
	//this get works fine
	obj, err := client.GetObject(bucket, fileName, minio.GetObjectOptions{})
	if err != nil {
		fmt.Println(err)
		return nil
	}
	reader := bytes.NewReader(contents)
	//this put fails
	_, err = client.PutObject(bucket, "test.jpeg", reader, reader.Size(), minio.PutObjectOptions{})
	if err != nil {
		fmt.Println(err)	//this is where I get the error
	}


This textbox defaults to using Markdown to format your answer.

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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

There has been a similar problem reported here:

https://www.digitalocean.com/community/questions/getting-x509-certificate-signed-by-unknown-authority-minio-sdk-for-spaces

The suggested solution was to update your CA certificates as described here:

http://manpages.ubuntu.com/manpages/bionic/man8/update-ca-certificates.8.html

And also try to update your packages too just in case.

Let me know how it goes.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.