Hi everyone,
First, thank you for the service you provide. Amplify is a great and powerful tool.
To explain my issue, I followed the tutorial for creating a user profile record: https://docs.amplify.aws/react/build-a-backend/functions/examples/create-user-profile-record/.
Everything works fine, as the record is created successfully. However, when a user tries to reset their password, I encounter the following error: "PostConfirmation failed with error [object Object]" and nothing happens.
In the Lambda logs, I see the following:
2024-08-06T14:32:14.415Z c9ec2afe-114b-44eb-83e6-73e9ec0e180f ERROR Invoke Error
{
"errorType": "Error",
"errorMessage": "[object Object]",
"stack": [
"Error: [object Object]",
" at Object.intoError (file:///var/runtime/index.mjs:46:16)",
" at Object.textErrorLogger [as logError] (file:///var/runtime/index.mjs:684:56)",
" at postError (file:///var/runtime/index.mjs:801:27)",
" at done (file:///var/runtime/index.mjs:833:11)",
" at fail (file:///var/runtime/index.mjs:845:11)",
" at file:///var/runtime/index.mjs:872:20",
" at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
]
}
This error message is not very explicit, and I still don't get why I have this... Here is my code :
auth/post-confirmation/handler.ts (the only part different from tutorial)
export const handler: PostConfirmationTriggerHandler = async (event) => {
await client.graphql({
query: createUserProfile,
variables: {
input: {
email: event.request.userAttributes.email,
profileOwner: `${event.request.userAttributes.sub}::${event.userName}`,
credits_available: 10,
credits_used: 0,
},
},
});
return event;
};
auth/post-confirmation/ressource.ts
same than tutorial
Do you now how I could fix this error, and also better debug ? Thanks !