[
https://issues.apache.org/jira/browse/FINERACT-615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16851236#comment-16851236
]
Dylan Robson commented on FINERACT-615:
---------------------------------------
I was able to reproduce both the 403 and the 500 status codes when uploading
documents with S3 enabled.
I think both codes are related to S3-specific configuration errors and not
Fineract itself.
This bug happens because S3 was toggled as enabled at Admin > System > Config,
but the admin must also set their S3 connection values at Admin > System >
External Services > S3.
Steps
# Enable Amazon S3 at
> “Admin” tab
> “System”
> “Configurations”
Note: In order to reproduce this issue, the values at External Services
Configuration for Amazon S3 were empty (or in the case of the 403 status code -
the bucket name was invalid according to S3's specifications)
# Upload document for a client at
> “Clients”
> Select a client
> “Documents” tab
> “+ Upload” button
> Select a doc to upload and enter a doc name
> *DON’T* click the document submit button yet
# Then, in Firefox (similar for Chrome):
> Right click page
> “Inspect Element”
> “Network” tab
> Click document “Submit” button
> Click the row that says:
“Status” = (500 or 403), and
“Method” = “POST”, and
“File” = “documents”
> “Response” tab
On localhost upload document
=> 500 (IllegalArgumentException).
On staging.openmf upload document
=> 500 (IllegalArgumentException).
On demo.openmf upload document
=> 403 (InvalidBucketName).
The localhost and staging both respond with the 500 status that says:
“error = Internal Server Error
exception = java.lang.IllegalArgumentException
message = Secret key [or access key] cannot be null.”
The demo.openmf response with the 403 status says:
"The specified bucket is not valid. Service: Amazon S3; Status Code: 400; Error
Code: InvalidBucketName ... ”
* (See last page and *[3]* for info about valid S3 bucket names).
* In the default Fineract server DB, the s3_secret_key and s3_access_key are
null, causing the 500 status code.
* These keys needs to be configured by the FI using Fineract in order to use
Amazon S3 for file storage.
* See *[1]* and *[4]* and next page.
* For info of where to find the Amazon S3 access key and secret key see *[2]*.
(Note: I Haven’t tried this because I don’t have an AWS S3 account, but it
looks like a good resource).
*SOLUTION:*
To enable Fineract to use Amazon S3 for file storage the FI admin must find
their S3 keys (see *[2]*) and their S3 bucket name (see *[3]*) and then do the
following:
> “Admin” tab
> “System”
> “External Services”
> “External Services - S3 Amazon Service Configuration”
> “Edit” button
> Update values of s3_access_key, s3_secret_key, and s3_bucket_name
* NOTE: Amazon S3 has *_strict_* requirements for bucket names. Bucket names
must have no capital letters and no underscores. For a list of all naming
requirements see resource *[3]*.
> “Submit” button
Resources:
[1]
[https://github.com/apache/fineract/commit/9c1f9cd912ea58b42f07da23c963c50292c05a06]
[2] [https://xfilespro.com/accesskeys3/]
[3] [https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html]
[4] (Scroll up to see S3 config option names)
[https://demo.openmf.org/api-docs/apiLive.htm#configs_externalService_retrieve]
> Throwing 500 internal server error, if we try to upload documents when
> Amazon S3 is enabled.
> ---------------------------------------------------------------------------------------------
>
> Key: FINERACT-615
> URL: https://issues.apache.org/jira/browse/FINERACT-615
> Project: Apache Fineract
> Issue Type: Bug
> Components: System
> Affects Versions: 1.0.0
> Reporter: Santosh Math
> Assignee: Shruthi M R
> Priority: Critical
> Labels: gsoc, p1
> Fix For: 1.4.0
>
>
> Not able to upload following documents and throwing 500 internal server
> error in the following cases:
>
> # Client Documents( Find tab in any client's page)
> # Client picture/photo( On right side of clients page)
> # Client's signature(Go to 'More' on Client's page
> # Loan Documents (Find the tab on any active loan)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)