Describe the bug
I have created a react native app but I am running into an issue where I am not able to list my directories and content of the directories in the my S3 bucket. I am using the following code:
componentWillMount(){
console.log('Calling S3');
console.log(Auth.currentCredentials());
Storage.list('/', { level: "public" })
.then (result => console.log('Result:', result)) // {key: "test.txt"}
.catch(err => console.log(err)});
}
Expected behavior
To see directories and contents of directories in S3 bucket.
Related issue: #2828
I just now figured this out as I was having the same issue. Take out the forward slash in Storage.list() and make it like Storage.list('', { level: "public" })
.then (result => console.log('Result:', result)) // {key: "test.txt"}
.catch(err => console.log(err)});
When you have it like '/' it adds another / at the end of the url and breaks it. Seems like a bug to me
@josephpaulmckenzie tried that and still not able to get it working.
After turning on logs, found the following:
if path provided
[DEBUG] 58:15.430 AWSS3Provider - list <path>/ from public/<path>
if path not provided
[DEBUG] 01:21.831 AWSS3Provider - list from public/
Then after manually adding public/ folder within bucket, things started working and able to see list of items and folders.
@tmoore23, is this issue safe to close?
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
Most helpful comment
After turning on logs, found the following:
if path provided
[DEBUG] 58:15.430 AWSS3Provider - list <path>/ from public/<path>if path not provided
[DEBUG] 01:21.831 AWSS3Provider - list from public/Then after manually adding
public/folder within bucket, things started working and able to see list of items and folders.