New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access Denied when trying to access a resource from S3 #13296
Comments
Now I'm able to get the image but I needed to update permissions for both the bucket and the file manually. do you know if is there a way to upload a file using uploadData method from aws amplify with the correct permissions? at least I want the images showing up with public permissions. @cwomack |
COuld i understand your case case a little bit more. Like the folder structure u are trying to upload to and how you want the permission to work between the folders. With Amplify Gen2, you can now do more flexible folder permissioning refer docs https://docs.amplify.aws/gen2/build-a-backend/storage/ |
Hey @ashika112, basically I want to store cover images for some records in the database. I think they can have public access. But following the Amplify Docs: https://docs.amplify.aws/react-native/build-a-backend/storage/upload/, I'm able to upload images to s3, but they always upload with no public access, even after assigning accessLevel: 'guest', which is supposed to give public access to the file. So I'm just wondering how can I assign public access with I will take a look at the docs you shared tho, thanks for your response. |
Thanks @fimbres . On your network tab can you check if both upload/download calls are made to the same place in s3 bucket? |
Yes I see the calls @ashika112, but they returned the 403 access denied error. |
Hey, any thought on this one? @ashika112 @cwomack |
Can u post screenshot of ur network call it will help us debug faster. Make sure to redact sensitive info. This can only happen when there is a mismatch with the two below. That said , things i would check is
|
Also another thing in ur code, is to Make sure to either pass in the same |
@fimbres, we've officially launched the Gen 2 Developer Experience for Amplify as of 5/06/24. Check out our launch blog post for more information, but can you let us know if you're still experiencing this blocker in Gen 2 now that it's generally available? Also, when you say that you're looking for "public" access on the bucket... do you mean a truly public URL/bucket access that anyone can access outside of the unauth/auth roles for your app? |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Storage
Amplify Version
v6
Amplify Categories
storage, api
Backend
Amplify CLI
Environment information
Describe the bug
I'm trying to upload and download a couple of images. I think I uploaded successfully tomy S3 bucket. Because at least I'm able to download the image through the AWS Console. But I'm not able to get it showing up in my React Native app. I can get the following link. but it always throws a 403 error. I followed the documentation here: https://docs.amplify.aws/react-native/build-a-backend/storage/download/#generate-a-download-url
But it doesn't work.
Expected behavior
get my images showing up in my app.
Reproduction steps
Install dependencies.
Run expo ios
Signup
Upload a profile photo
You won't be able to see your profile photo when signing in
Code Snippet
Log output
aws-exports.js
/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "us-east-1",
"aws_appsync_graphqlEndpoint": "",
"aws_appsync_region": "us-east-1",
"aws_appsync_authenticationType": "API_KEY",
"aws_appsync_apiKey": "",
"aws_cognito_identity_pool_id": "",
"aws_cognito_region": "us-east-1",
"aws_user_pools_id": "us-east-1_s9MyA77nH",
"aws_user_pools_web_client_id": "",
"oauth": {},
"aws_cognito_username_attributes": [
"EMAIL",
"PHONE_NUMBER"
],
"aws_cognito_social_providers": [],
"aws_cognito_signup_attributes": [
"EMAIL"
],
"aws_cognito_mfa_configuration": "OFF",
"aws_cognito_mfa_types": [
"SMS"
],
"aws_cognito_password_protection_settings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": []
},
"aws_cognito_verification_mechanisms": [
"EMAIL"
],
"aws_user_files_s3_bucket": "***",
"aws_user_files_s3_bucket_region": "us-east-1"
};
export default awsmobile;
Manual configuration
No response
Additional configuration
No response
Mobile Device
Iphone 15 pro Simulator
Mobile Operating System
IOS 17.4
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: