function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jonathan Thornton 4Jonathan Thornton 4 

Amazon S3 Delete Issue

Hello, I was hoping someone might have some help with an issue I've been struggling with for days. I'm attempting to delete files in Salesforce from AWS S3, which should be easy enough. This is the first time I’ve worked with AWS S3 and there doesn't seem to be a current official SDK or anything that I can find for Salesforce / AWS S3. There’s some deprecated SOAP SDK from 10 years ago but I found another third-party SDK here https://bigassforce.com/aws-sdk (https://bigassforce.com/aws-sdk)which seems to work but here's where I encounter my problem:

The S3 keys are often stored with spaces in them from the Account Name or File Name e.g. Key = ‘<Account.Name> + ‘ ‘ + <Object.Id> + ‘/’ + <filename>’. So something like: ‘Test Account1 012a00000gXQ9nAAG/my picture.jpg’

I don’t know why they were stored this way but it throws an error every time there are spaces in the Key. "Error: The request signature we calculated does not match the signature you provided. Check your key and signing method." No spaces, no problem; I can delete. I’ve tried URIEncoding them, and it may just be the SDK I’m using but that throws the same error as well. Any special characters seems to throw that same error. Am I going about this the wrong way? Should I write it manually via REST? There doesn’t seem to be any examples of how to do this unfortunately that I can find.

Any help is greatly appreciated, thank you!

Jonathan