Signed URL from Storage.get() call not working
See original GitHub issueBefore opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
5.1.2
What operating system are you using?
Ubuntu
Amplify Categories
storage
Amplify Commands
Not applicable
Describe the bug
I am trying to have profile image upload functionality for users in my application.
Storage.put(filename, uri, {
level: 'public',
contentType: 'image/*'
});
const imageUrl = await Storage.get(filename) as Promise<string>;
The above two function calls are working. I checked that the image got stored in the S3 bucket. However when I try to open the url imageUrl, it shows AccessDenied. I want to know how this is possible and how I can solve the issue. If the user was able to put the object and get it, why was it not able to show the image?
Expected behavior
The image url should be able to return image.
Reproduction steps
- Available in description.
GraphQL schema(s)
No response
Log output
No response
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Firebase Cloud Storage signed url upload fails with ...
Firebase Cloud Storage signed url upload fails with "Anonymous caller does not have storage. objects. create access" - Stack Overflow. ...
Read more >Signed URLs | Cloud Storage - Google Cloud
This page provides an overview of signed URLs, which give time-limited access to a specific Cloud Storage resource. Anyone in possession of the...
Read more >Sharing objects using presigned URLs - AWS Documentation
Describes how to set up your objects so that you can share them with others by creating a presigned URL to download the...
Read more >Storage - Download files - JavaScript - AWS Amplify Docs
Very common issue: Calling Storage.get for a nonexistent file, or incorrect credentials, does not throw an error because that would involve an extra...
Read more >Download files with Cloud Storage on Web - Firebase
Note: By default, a Cloud Storage bucket requires Firebase Authentication to ... You can get the download URL for a file by calling...
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 Free
Top 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
@petercwk Thanks, this solved the issue.
As a suggestion, I think it would be better if Storage.get() call fails will error if the user does not have enough permission.
@kgoyal98 It could possibly be your permissions configuration. Could you please try the suggestions in this previously closed ticket: https://github.com/aws-amplify/amplify-js/issues/6777#issuecomment-691261407