Skip to main content
johnb77214017
Inspiring
February 14, 2024
Answered

Why can I use downloadToFile but not <cffile> for S3?

  • February 14, 2024
  • 3 replies
  • 1856 views

I am trying to figure this out. Anything I try that uses s3:// prefix like readAsBinary() always ends up with "The AWS Access Key Id you provided does not exist in our records". Yet when I use downloadToFile() on the bucket object, there are no issues. Are there special perms to use that prefix? I am not the AWS admin.

CF2023.

    This topic has been closed for replies.
    Correct answer johnb77214017

    It sounds like it's on your AWS admin at this point.  Wish I could help further.


    yup, he figured it out. Thanks for the help. Any troubles with directoryCopy() to S3? I just seem to get nothing. No errors even.

    3 replies

    johnb77214017
    Inspiring
    February 16, 2024

    So the file functions are no longer valid in CF2023 from what Adobe told me.

    quoteMe: So none of the file tags are usable anymore?

    Yes, please use the new implementation going forward.
     
    Thanks,
    Vikram



    Charlie Arehart
    Community Expert
    Community Expert
    February 16, 2024

    That's news to me. There's no mention of that anywhere I know of, though I could be wrong. But I do pay very close attention to such deprecation and removals.

     

    Now, there WAS a bug where some of the old s3 approaches failed, and it was fixed by the updates in October: cf2023 update 5, and cf2021 update 11. John, can you clarify what update you're on?

     

    More on that (fixed) bug here:

    https://tracker.adobe.com/#/view/CF-4218035

    /Charlie (troubleshooter, carehart. org)
    Legend
    February 23, 2024

    It's all tags/functions. Except for the "new" way.

     

    So i recreated the whole config in my personal aws account and it works fine. so our admin has something else set that is denying this. Trying to explain that.

     

     


    It sounds like it's on your AWS admin at this point.  Wish I could help further.

    Legend
    February 14, 2024

    What I believe is happening is you are mixing up the different methods CF provides of accessing S3.

     

    Prior to ColdFusion introducing Multi-cloud services (in 2021, I believe?) there was still a way to easily access S3 with most CF file manipulation functions.  And that was to use the prefix "s3://" on any operation of CFFILE or other file functions.

    However, in order to use that prefix, one of the ways to get it to work was to include the AWS accesskey and Client Secret in the file path.  So, your call would need to look something like:

    s3://#yourAccessKey#:#yoursecretKey#@yourbucket/foldername/filename.txt

     

    (I believe you may be able to declare these keys in the application file so as not to need them in the path, but I always had trouble getting that to work reliably)

     

    In addition, you would then need to set the ACL permissions with the storeSetACL() function if you wished the file to be made available to others..

    In regard to the downloadToFile() function.  That is part of the new Multi-cloud functionality.  The credentials and setup of that connection are likely already set up in your CFAdmin so you don't have to mess with the credentials in the code.

     

    Here is the documentation for CF Cloud services.

     

    Only functions listed in there will use your pre-configured cloud configs in CFAdmin.

     

    All other file manipulation, using s3://, must include the access key and client secret.

    johnb77214017
    Inspiring
    February 14, 2024

    Thanks for reply, unfortunately I have tried that as well, to no avail.

     

    johnb77214017
    Inspiring
    February 14, 2024

    I don't see an edit button....