frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.92k stars 7.35k forks source link

AWS S3 Backups on Version 15 #39500

Open smitz96 opened 10 months ago

smitz96 commented 10 months ago

Information about bug

S3 Backups doesn't work properly. It says backup has been completed successfully but the backup is not reflected onto AWS cloud. Backups are generated on to ERP server but are not pushed to S3 cloud. Using the following guide to setup backups on S3. https://docs.erpnext.com/docs/user/manual/en/aws_s3

Module

integrations, other

Version

"erpnext": "15.0.0", "frappe": "15.0.1", "payments": "0.0.1"

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

An error occurred (301) when calling the HeadBucket operation: Moved Permanently
OpenSourceJedi commented 9 months ago

This may be due to Amazon deprecating the S3 bucket path. The new S3 bucket path requirement puts the bucket name in front of the URL (https://$bucketname.s3.amazonaws.com) as opposed to the old path of the bucket name after the URL (https://s3.amazonaws.com/$bucketname). Seems like this started taking effect in the last month or so.

Here is a sample response from Amazon:

<Error>
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>$bucketname.s3.amazonaws.com</Endpoint>
<Bucket>$bucketname</Bucket>
<RequestId>D1GWAGW9H9G61HFC</RequestId>
<HostId>lLzP5vRIcImkXCUJGyDmCg41jPUQXtETvXnZvzP4fRAQh4JiU8uOT5gSnsKwFflXyIbb0qfmbmk=</HostId>
</Error>
smitz96 commented 9 months ago

Tried changing the URL but got the following error. An error occurred (400) when calling the HeadBucket operation: Bad Request

Endpoint URL: https://ANME_OF_MY_BUCKET.s3.ap-south-1.amazonaws.com Following the official guide here: [https://docs.erpnext.com/docs/user/manual/en/aws_s3]

OpenSourceJedi commented 9 months ago

Unfortunately I don't think it is that simple. I believe the ERPNext code generates the URL on the backend with the old format. The code will have to be modified.

prononext commented 4 months ago

**its working. You just need to lookup the exact Endpoint for your S3 Bucket here:

https://docs.aws.amazon.com/general/latest/gr/s3.html**

Be sure to NOT include your bucket name in the endpoint url field and leave them seperate.

Had the same problem with old s3 url s3.amazonaws.com and looked up the correct one for my bucket region. I guess it has something todo with AWS changing the routing of their bucket urls. Now its working agin nicely. No code needed to be changed in the backend.