We are using Amplify to manage the coginto credentials and once a while we will get this error when using the credentials: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
It does not happen often, happens once a day for us. Very hard to trigger.
The way we use it is like this:
const getDocumentClient = (): Promise<DocumentClient> =>
Auth.currentCredentials().then(
(credentials) =>
new DynamoDB.DocumentClient({
region: REGION,
credentials: Auth.essentialCredentials(credentials),
})
)
export const getItemFromSettingsTable = async (
Key: KeyType
): Promise<DocumentClient.GetItemOutput> => {
const params = {
TableName: xxx,
Key,
}
const client = await getDocumentClient()
return client.get(params).promise()
}
According to the stacktrace, we are getting the error when call the getItemFromSettingsTable.
It seems to be a race condition issue, since it usually does not happen.
Anyone run into this before?
Thanks.