Need help with Amazon S3 - Missing Parent Directory

260 views
Skip to first unread message

ML

unread,
Mar 28, 2015, 2:15:24 AM3/28/15
to lu...@googlegroups.com
Hi,

I am trying to copy a file to S3 drive but keeps getting the "missing parent directory" error.  There was a lengthy discussion on the railo group and the bug seems to have been fixed by version 4.04.  However, I keep getting the same error with Railo 4.2.1 and Lucee 4.5.  So the issue is likely my code, but I have tried various combinations and still I can't get it to work:

filePath
= "C:\image6.jpeg";
accessKeyId
= "XXXXXXXXXXXXXXXXXX";
awsSecretKey
= "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
bucketName
= "mybucket";
fileDestination
= "s3://" & accessKeyId & ":" & awsSecretKey & "@" & bucketName & "/image6.jpeg";

fileCopy
( filePath, fileDestination );

I have also tried these:
fileDestination = "s3://" & accessKeyId & ":" & awsSecretKey & "@s3.amazonaws.com/" & bucketName & "/image6.jpeg";
fileDestination
= "s3://" & accessKeyId & ":" & awsSecretKey & "@us-west-2/" & bucketName & "/image6.jpeg";


I have also put the keys in Application.cfc and just do:
fileDestination = "s3://" & bucketName & "/image6.jpeg";

But none of them works. What am I missing?

Thanks,
ML

Evagoras Charalambous

unread,
Mar 30, 2015, 10:06:30 AM3/30/15
to lu...@googlegroups.com
I have also run into issues with defining the accessKey and SecretKey in the file destination. Adding them in the Application scope helped fix those. Your code looks ok, although I use this to write to it:
file action="write" file="#fileDestination#" output="#binContent#" nameconflict="overwrite";

Also, make sure your bucketname on s3 is public, so you can see your resources through a browser once you upload them. I also give the uploaded file the correct properties after the save:
<cfset storeSetACL(
       
loc.s3File,
        [
            {
               
group="all",
               
permission="read"
            },
            {
               
id="#APPLICATION.settings.canonical_user_id#",
               
permission="full_control",
               
displayName=""
            }
        ]
        )
/>


Adam Chapman

unread,
Jul 6, 2015, 4:19:18 AM7/6/15
to lu...@googlegroups.com
Bump! I'm also having this issue.. Has anyone found any solutions.. I'm on the verge of writing a wrapper for the S3 Java API..

Adam

James Holmes

unread,
Jul 6, 2015, 4:40:01 AM7/6/15
to lu...@googlegroups.com

Warning: this is a typical "tangentially related, not actually solving the original issue" post.

Using keys is a very bad idea. IAM roles provide far better security, mainly because it's nearly impossible to accidentally push a key to github (where people run bots that scan for AWS keys that people accidentally pushed to github) and have your entire account held to ransom or used for Bitcoin mining. Obviously, if your server is not an AWS instance, IAM roles aren't available.

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/8d95725c-176b-4281-9a4d-18023b7d8f1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages