Open saurabhunde opened 3 months ago
Amplify documentation really needs a revamp. A lot of things are either not documented or fail to work :(
@nadetastic Please assist us with this issue.
If it helps, I am mentioning below links of previously riased issues of same project by our team. https://github.com.mcas.ms/aws-amplify/amplify-cli/issues/13240 https://github.com.mcas.ms/aws-amplify/amplify-js/issues/13119
Hello, @saurabhunde 👋. It looks like you're missing the identityPoolId
in your scoped Auth config. See an example of what the shape should look like here (click on existing resources block switcher). Can you add that in and see if you still get the error?
@sumitsahoo, that's valid feedback and we would love to hear how we can make it better! Feel free to open up a docs issue here or let me know via a reply back if there's something specific you're looking for. I think we could make the scoped examples for configs a little easier to find (rather than buried inside that last option of the block switcher).
@cwomack I have added identityPoolId
in the scoped Auth config and now the error has changed.
Updated Auth config:
Amplify.configure({
Auth: {
mandatorySignIn: false,
Cognito: {
userPoolClientId: amplifyconfig.aws_user_pools_web_client_id,
userPoolId: amplifyconfig.aws_user_pools_id,
loginWith: {
oauth: {
domain: amplifyconfig.oauth.domain,
scopes: ['openid email aws.cognito.signin.user.admin'],
redirectSignIn: ['http://localhost:5173'],
redirectSignOut: ['http://localhost:5173'],
responseType: 'code',
},
},
identityPoolId: amplifyconfig.aws_cognito_identity_pool_id,
},
},
API: {
GraphQL: {
endpoint:
xyz.aws_appsync_graphqlEndpoint,
region: 'eu-west-1',
// Set the default auth mode to "userPool"
defaultAuthMode: 'userPool',
},
},
Storage: {
S3: {
bucket: "xyz-dev",
region: "eu-west-1",
},
}
});
Here is error message:
InvalidIdentityPoolConfigurationException: Invalid identity pool configuration. Check assigned IAM roles for this pool.
at parseJsonError (http://localhost:5173/node_modules/.vite/deps/chunk-IFRJ7B24.js?v=ca1ab44f:2871:17)
at async getCredentialsForIdentityDeserializer (http://localhost:5173/node_modules/.vite/deps/chunk-IFRJ7B24.js?v=ca1ab44f:4387:19)
at async CognitoAWSCredentialsAndIdentityIdProvider.credsForOIDCTokens (http://localhost:5173/node_modules/.vite/deps/chunk-S5WU6PHE.js?v=ca1ab44f:4865:26)
at async AuthClass.fetchAuthSession (http://localhost:5173/node_modules/.vite/deps/chunk-IFRJ7B24.js?v=ca1ab44f:1010:34)
at async resolveS3ConfigAndInput (http://localhost:5173/node_modules/.vite/deps/chunk-K4YCOUCR.js?v=ca1ab44f:641:39)
at async list (http://localhost:5173/node_modules/.vite/deps/chunk-K4YCOUCR.js?v=ca1ab44f:1984:51)
at async listAllBuckets (http://localhost:5173/src/components/PAVManagement/PAVForm.jsx:68:22)
Hi @cwomack , Thank you for your reponse on my issue. Could you please provide an exmaple IAM role and its policies that we can add to Cognito Identity Pool which allows CRUD operations on S3 for authenticated Cognito users? As menioned by @sumitsahoo, we are facing above error even after adding identity pool id in Amplify configuration
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Storage
Amplify Version
v6
Amplify Categories
auth, storage
Backend
Amplify CLI
Environment information
Describe the bug
I am trying to perform List, Upload file actions in my amplify react application. But I am getting below error while performing file upload and list files operations.
Error : NoCredentials: Credentials should not be empty.
Note- We are using federated usrs from Azure AD and have configured Azure AD ipd using SAML. All of the users will logging through this idp only. And we need to provide S3 file access to logged in users only.
I followed below steps to add and configure storage using Amplify CLI. Please refer below section
Expected behavior
Reproduction steps
amplify add storage
Answered questions like below
Content (Images, audio, video, etc.)
Yes
Default configuration
No, I am done.
testS3
testS3bucket
Auth users
create/update, read, delete
No
Configured- Amplify.configure({ .... //added S3 config Storage: { S3: { bucket: "testS3bucket", region: "us-east-1", } } })
Refer File upload and List files code from below code snippets
Code Snippet
Log output
Console Error while listing files
Console error while upload
aws-exports.js
No response
Manual configuration
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response