Question

cannot delete file from digital ocean spaces

followed documentation, link : https://docs.digitalocean.com/products/spaces/resources/s3-sdk-examples/#delete-a-file-from-a-space

Spaces region is FRA1 (frankfurt, germany)

using NodeJS backend (express + ubuntu OS), got success response in console but file is not deleted in spaces.

success response :

Success { ‘$metadata’: { httpStatusCode: 204, requestId: undefined, extendedRequestId: undefined, cfId: undefined, attempts: 1, totalRetryDelay: 0 }, DeleteMarker: undefined, RequestCharged: undefined, VersionId: undefined }


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, I use the go AWS s3 sdk to manage the spaces.

When i try to use the WithContex… version of delete method, I’m getting the error “Not Implemented”:

	if _, err := c.s3.DeleteObjectsWithContext(ctx, &s3.DeleteObjectsInput{
		Bucket: aws.String(c.bucket),
		Delete: &s3.Delete{
			Objects: []*s3.ObjectIdentifier{{
				Key: aws.String(path),
			}},
		},
	}); err != nil {
		return err // <-- not implemented here
	}

But version without context does not return error and object got deleted (I can confirm it looking to the web interface if the Spaces). However the method does not return error even if I’m trying to delete not existing object:

	if _, err := c.s3.DeleteObject(&s3.DeleteObjectInput{
		Bucket: aws.String(c.bucket),
		Key:    aws.String(path),
	}); err != nil {
		return err //<-- always nil and object deleted
	}

Hello,

It sounds like you might have CDN enabled.

If this is the case, then you would need to purge your CDN cache if you want the deleted files to be purged from the CDN cache directly:

https://docs.digitalocean.com/products/spaces/how-to/manage-cdn-cache/

Let me know how it goes.

Best,

Bobby