Open Mastergalen opened 3 years ago
Got the same error and the same deactivation workaround worked for me.
I have the same issue when trying to import/export. Export can write to S3 but can't read from it. Import can't move the local uploaded file over to S3 to attempt the import. Disabling this plugin gave an error about not being able to create the media folder (probably because its ephemeral/scratch data storage maybe? Either way this should be working, and the fact that we can write to s3 from export but not move to s3 from import upload is confusing.
According to the AWS docs the modes supported include (r, w, a, x). As you say it would error if you using a+ as the library s3 uploads uses to handle the fopen will not support it.
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-stream-wrapper.html
What you could do is copy the [plugins/woocommerce/includes/export/abstract-wc-csv-batch-exporter.php] file into your theme, change the a+ to be a and include it in your functions. I have tested it and it works perfectly.
I have also created a PR request as per https://github.com/woocommerce/woocommerce/pull/33652/files to hopefully see if WooCommerce would accept my filter proposition to allow an fopen orride more "easily"
Found a workaround that works well
add_filter( 'woocommerce_csv_exporter_fopen_mode', 'custom_woocommerce_csv_exporter_fopen_mode' ); function custom_woocommerce_csv_exporter_fopen_mode( $mode ) { return 'a'; }
I'm trying to generate a new report in WooCommerce Admin, which is trying to write the .csv report to
wp-content/uploads/woocommerce_uploads/reports/wc-orders-report-export-16327718422508.csv
I suppose there are no plans to support
a+
mode, so is there perhaps a way to have an exclude list of paths which the S3-uploads plugin ignore, and allows plugins to write to the local file system instead?I'm currently working around this by disabling the S3 plugin temporarily when generating the report. Obviously, that's not great in a production environment as it breaks all the images while disabled 😅.