You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get this error when using the list function from 'aws-amplify/storage'
import { list } from 'aws-amplify/storage'
const result = await list({
path: ({identityId}) => `media/{identityId}/`
})
arn:aws:sts::REDACTEDACCOUNTID:assumed-role/amplify-d3su8b8ts26mem-st-amplifyAuthauthenticatedU-xrRLyt00Gu8C/CognitoIdentityCredentials is not authorized to perform: s3:ListBucket on resource: "arn:aws:s3:::amplify-d3su8b8ts26mem-st-REDACTEDBUCKETNAME760f-k0jit9xertfc" because no identity-based policy allows the s3:ListBucket action
But I am clearly authenticated as I manage to put objects in this bucket, the storage is defined as follows :
import { defineStorage } from '@aws-amplify/backend';
export const storage = defineStorage({
name: 'REDACTEDBUCKETNAME',
access: (allow) => ({
'media/{entity_id}/*': [
// {entity_id} is the token that is replaced with the user identity id
allow.entity('identity').to(['write','list'])
]
})
});
And I do have an IAM policy attached to this user with permissions PutObject and ListBucket, this policy has been created automatically by aws amplify, I am just stupidly following the docs.
Reproduction steps
Define a storage with permissions write and list
export const storage = defineStorage({
name: 'REDACTEDBUCKETNAME',
access: (allow) => ({
'media/{entity_id}/*': [
// {entity_id} is the token that is replaced with the user identity id
allow.entity('identity').to(['write','list'])
]
})
});
Try to list in your client code
import { list } from 'aws-amplify/storage'
const result = await list({
path: ({identityId}) => `media/{identityId}/`
})
The text was updated successfully, but these errors were encountered:
@ykethan Thanks I should have caught it ... What puzzles me is that the policy attached to the auth role seems legit, so the missing $ may not have messed the path...
Environment information
Describe the bug
I get this error when using the list function from 'aws-amplify/storage'
arn:aws:sts::REDACTEDACCOUNTID:assumed-role/amplify-d3su8b8ts26mem-st-amplifyAuthauthenticatedU-xrRLyt00Gu8C/CognitoIdentityCredentials is not authorized to perform: s3:ListBucket on resource: "arn:aws:s3:::amplify-d3su8b8ts26mem-st-REDACTEDBUCKETNAME760f-k0jit9xertfc" because no identity-based policy allows the s3:ListBucket action
But I am clearly authenticated as I manage to put objects in this bucket, the storage is defined as follows :
And I do have an IAM policy attached to this user with permissions PutObject and ListBucket, this policy has been created automatically by aws amplify, I am just stupidly following the docs.
Reproduction steps
Define a storage with permissions write and list
Try to list in your client code
The text was updated successfully, but these errors were encountered: