Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 Upload on Windows server #652

Open
workcodework opened this issue Sep 14, 2023 · 4 comments
Open

S3 Upload on Windows server #652

workcodework opened this issue Sep 14, 2023 · 4 comments

Comments

@workcodework
Copy link

Hey,

I need your help. I can't seem to get S3 Uploads to work with Wordpress, on a windows server.
With S3 Upload enabled, I'm unable to upload anything via media library to AWS.

The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.

This only happens when the S3 Upload plugin is enabled. We've migrated the same website (which had no issue with S3 Upload) from a non-windows server, with all major settings in tact or applied.

What could be issue here?

@rmccue
Copy link
Member

rmccue commented Sep 14, 2023

You'll need to check your PHP error log to find out exactly what the error here, as I believe this message is a generic error message when something fails to upload.

Please note that we can't provide extensive support for debugging, so you'll need to dig into this yourself first: https://engineering.hmn.md/projects/support/

@workcodework
Copy link
Author

workcodework commented Sep 14, 2023

Understood and I appreciate the help.

There doesn't seem to be a lot of resources on my predicament.
This is the error log (after trying to upload image in WP Media Library):

[14-Sep-2023 16:52:26 UTC] PHP Warning: scandir(): S3_Uploads\Stream_Wrapper::dir_readdir is not implemented! in D:[REDACTED]\wp-content\plugins\S3-Uploads-1\inc\class-plugin.php on line 676
[14-Sep-2023 16:52:26 UTC] PHP Fatal error: Uncaught exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "ListObjectsV2" on "https://[REDACTED].s3.ap-southeast-1.amazonaws.com/?list-type=2&delimiter=%2F&prefix=uploads%2F2023%2F09%2Fnewsletter-field-desktop"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://[REDACTED].s3.ap-southeast-1.amazonaws.com/?list-type=2&delimiter=%2F&prefix=uploads%2F2023%2F09%2Fnewsletter-field-desktop'

Seems like SSL/cURL AWS connection issue?

Edit: Got it. not asking for extensive support. Thanks anyway

@tomjn
Copy link
Contributor

tomjn commented Sep 25, 2023

dir_readdir is implemented: https://github.com/humanmade/S3-Uploads/blob/master/inc/class-stream-wrapper.php#L693

error: cURL error 60: SSL certificate problem: unable to get local issuer certificate

It's more likely to be the AWS SSL issue, perhaps you've got a custom certificate setup via a custom root certificate authority? If that's the case I'm not sure what to advise

@workcodework
Copy link
Author

workcodework commented Sep 26, 2023

Thanks for the input @tomjn.

We resolved the issue on our win IIS server as follow (roughly):

  1. Installed the php extension cURL and SSL

  2. Followed by latest version of cacert.pem (certificate configuration), https://curl.se/docs/caextract.html
    Learn more here: https://stackoverflow.com/questions/38667165/amazon-s3-upload-error-ssl-certificate-issues/38667282#38667282

  3. Upload is working, but 0 bytes files were getting uploaded.
    Solved it by added this line to wp-config.php: define( 'S3_UPLOADS_OBJECT_ACL', ‘private’);
    Learn more here: 0 (zero) bytes files in s3 after upload #158

  4. Ran into the deletion issue (file deleted from WP didn't delete from S3)
    Adding to policy "s3:*" to Action worked
    Learn more here: delete media file #196

There was a lot of testing, so I may have missed a step or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants