LabVIEW Cloud Toolkits

cancel
Showing results for 
Search instead for 
Did you mean: 

AWS S3 Object Uploads Fail Signature Validation

Solved!
Go to solution

After I upload files to an S3 bucket using the AWS Toolkit, they appear to be slightly different than the original files. This happens regardless of whether I upload a file and set it to private or public.

 

Here's the original file:

CaseyM_1-1650903523276.png

 

And here's the copy after I upload and download it:

CaseyM_2-1650903547876.png

 

Anyone have any insights as to why this could be happening and how to resolve it?

 

CLA CLED AF Guild
0 Kudos
Message 1 of 4
(2,030 Views)
Solution
Accepted by topic author CaseyM

You will need a hex editor to prove this but I suspect that what has happened is that the "Upload file to bucket.vi" has stripped the CRLF (0x0D, 0x0A) characters from the start and end of the file. Assuming that this is the case, it is a problem that I have reported to NI under "[Request #: 01377336] NI Cloud Services for AWS Put Object from file.vi stripping leading and trailing /r/n characters"

They will probably tell you it is a "feature". In reality is is never going to be fixed. If you drill down from the top level vi you will eventually find a trim statement that is applied to the file once it has been converted into a character stream. I did not want to remove the trim as it may have other unforeseen consequences. The solution I adopted was to start using the Amazon CLI (Command Line Interface) to upload the file. You will need to install CLI, if you are not familiar with the CLI I would suggest reading the help files. I enclose a vi that I used to upload files or folders. Have a play and you should get it working without too much trouble. The vi is building a string like: aws s3 cp "source" "destination", there are a couple if examples in the block diagram. An interesting side effect, the CLI is much faster at uploading files that the "Upload file to bucket.vi"

0 Kudos
Message 2 of 4
(2,010 Views)

Thanks! I'd prefer to avoid the CLI if possible, but I'll give it a shot.

 

Maybe I can modify the API to include a flag to optionally skip the Trim Whitespace.vi...

CLA CLED AF Guild
0 Kudos
Message 3 of 4
(2,004 Views)

I found the VI you mentioned and, as you expected, the "Trim Whitespace" in there is indeed causing the issue.

 

I'll probably end up either playing around with your VI or modifying the existing API for my own use (maybe I'll submit a pull request as well) to make that part optional.

 

Thanks for the help!

CLA CLED AF Guild
0 Kudos
Message 4 of 4
(1,988 Views)