question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Signed URL from Storage.get() call not working

See original GitHub issue

Before 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

  1. Available in description.

GraphQL schema(s)

No response

Log output

No response

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kgoyal98commented, Aug 28, 2021

@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.

1reaction
petercwkcommented, Aug 27, 2021

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found