Logged in users can upload but not list files
See original GitHub issueDescribe the bug
I have a react app that is able to upload files to S3, however when trying to list files, the pre-flight OPTIONS request succeeds, but the actual list gets a 403.
The IAM role for the cognito user is:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"mobileanalytics:PutEvents",
"cognito-sync:*",
"cognito-identity:*"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::dev-drop-bucket-files/private/${cognito-identity.amazonaws.com:sub}/*",
"arn:aws:s3:::dev-drop-bucket-files/private/${cognito-identity.amazonaws.com:sub}"
],
"Effect": "Allow"
}
]
}
Here’s a sample of the code that is what I’m using for the uploads/downloads:
import { Storage } from "aws-amplify";
export async function s3Upload(file) {
Storage.configure({ level: 'private' });
const stored = await Storage.vault.put(file.name, file, {
contentType: file.type
});
return stored.key;
}
export async function listFiles() {
Storage.configure({ level: 'private' });
const files = await Storage.list('/');
return files;
}
Expected behavior
List should return a list of files.
Desktop (please complete the following information):
- OS: MacOS
- Browser Chrome
- Version 71.0.3578.98
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Set folder permissions to only show the logged in user what ...
Hello, Is it possible to set a document library's folder permissions to show the logged in user only what they have created, instead...
Read more >Customer Portal (Experience) User Can Upload Files to Case ...
However, the Customer Portal (Experience) user is only able to upload files to the case, but not able to see the files uploaded...
Read more >files and folders must be accessible by logged in users .How ...
You are creating folders, but if someone knows the URL it can access to it. What you could do is allow access only...
Read more >Manage external sharing for your organization - Google Support
To allow users to open files from domains that aren't on an allowlist and edit Google Docs, Sheets, Slides, and Sites stored on...
Read more >Tracking User Activity on Files - Box Support
Anonymous users -- people who are not logged in to Box and access a file using a shared link -- are not displayed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@marksteele can you try:
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.