How would I get the Authenticator username in a Lambda function? The auth resource is defined under amplify/auth/resource.ts and goes like this:
import { defineAuth } from '@aws-amplify/backend';
/**
* Define and configure your auth resource
* @see https://docs.amplify.aws/gen2/build-a-backend/auth
*/
export const auth = defineAuth({
loginWith: {
email: true,
},
groups: ["lambda"]
});
This is in a React project and uses the <Authenticator> component from @aws-amplify/ui-react (You need to be logged in to even see the button to trigger the Lambda function in the first place).
Tried to do fetchUserAttribtutes in the Lambda function, only to get this error:
{
"errorType": "AuthUserPoolException",
"errorMessage": "Auth UserPool not configured.",
"name": "AuthUserPoolException",
"recoverySuggestion": "Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId.",
"stack": [
"AuthUserPoolException: Auth UserPool not configured.",
" at file:///var/task/index.mjs:2:23640",
" at y (file:///var/task/index.mjs:2:26389)",
" at Mn (file:///var/task/index.mjs:22:4888)",
" at pr (file:///var/task/index.mjs:22:5107)",
" at file:///var/task/index.mjs:22:5126"
]
}
Even though I'm logged in and there's userPoolId in npx ampx sandbox, there is apparenty not a configured UserPool when I try to do fetchUserAttributes. So how would I go about having Lambda return the logged in user?