• Resolved LauraSuzy

    (@laurasuzy)


    My CDN is set to host attachments and custom files in AWS S3, using Origin Push Amazon Cloudfront over S3. Now when I upload images to the media library, they are not getting copied over to S3 (and therefore not delivered on the web site) unless I go to the CDN page and click the “upload attachments” button (which is annoying because it tries to upload every attachment in the entire media library database, not just the newest ones). It stopped working a month or two ago, I think.

    Here is some other info about plugins I have installed:

    WP 6.3.2 and PHP 8.2.7 on nginx

    Lots of plugins, but the ones that might be of concern include:

    I also had a hacking incident and I had to recreate all of my access keys and IAM users, but I don’t think that is related? Please let me know how I can overcome this problem!!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter LauraSuzy

    (@laurasuzy)

    I’d like to add some additional troubleshooting details:

    1. I tried rolling back to W3TC version 2.4.1 because i did not have the “not authorized” message, but it has the same problem where the images are not uploaded to S3.
    2. I tried W3TC versions 2.5 and 2.6 and still have the same problem, the newly uploaded images do not get automatically copied up to S3 like they used to.
    3. I did discover that if I go to the Media Library and click “Purge from CDN” on a specific recently uploaded image, it does correctly send that image to S3, and then it is visible on the site. So at least I have found a way to fix individual images as we upload them.

    Also, when I check my PHP error logs after doing step 3 above, and grep for the string “S3”, I see these results:

    /var/log/php-fpm/www-error.log:[07-Feb-2024 13:26:22 UTC] PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/app/current/wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/S3/S3Client.php on line 418

    /var/log/php-fpm/www-error.log:[07-Feb-2024 13:27:03 UTC] PHP Deprecated:? Use of “self” in callables is deprecated in /var/app/current/wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/S3/RegionalEndpoint/ConfigurationProvider.php on line 83

    Also, after clicking “Purge from CDN” for a specific image and seeing it show up, I get a lot of deprecation warnings in the error log, plus I also get this error in the unsuccessful file transfer queue: Unable to create invalidation batch (Error executing “CreateInvalidation” on “https://cloudfront.amazonaws.com/2018-11-05/distribution/E2KHU9V483SRE2/

    I’m not sure why it has that 2018 date in there? The photo was from 2015 and I just uploaded it today.

    Let me know if any of that information helps.

    Thread Starter LauraSuzy

    (@laurasuzy)

    I think I found the problem! I unchecked the “Only purge?CDN?manually” checkbox under “Advanced”, and that seems to have made it so that the images get uploaded automatically again. I don’t remember checking that box, but maybe I did at some point trying to fix some other problem.

    Hooray! I hope this helps someone.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @laurasuzy

    Thank you for reaching out and I am happy to help.
    Yes the “Only purge?CDN?manually” checkbox was added to the W3 Total Cache CDN settings specifically for the Cloudfront. Due to the number of invalidations and the fact that those can rise to several hundreds of dollars.

    The first 1,000 invalidation paths that you submit per month are free; you pay for each invalidation path over 1,000 in a month. An invalidation path can be for a single file (such as?/images/logo.jpg) or for multiple files (such as?/images/*). A path that includes the?*?wildcard counts as one path even if it causes CloudFront to invalidate thousands of files.

    This is why it’s best to enable this option, and maually push the images once they are uplaoded.

    I would also recommend you to use Pull instead of push CDN type as the push CDN type is not stable.

    As for the deprecated notices, we are working on the solution for this because if we fix these we need to bump the minimum php version also for the usage of the W3 Total Cache, so we are checking the best solution.
    I am glad that you managed to resolve this!

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CDN enabled but not authorized – must upload images manually’ is closed to new replies.