as @rw_ pointed out, my UserProfile.create in amplify/auth/post-confirmation/handler.ts
and the UserProfile defined in amplify/data/resource.ts
had different attributes. I updated the UserProfile model and changed name to email. This made the function work
amplify/data/resource.ts
const schema = a.schema({
UserProfile: a
.model({
email: a.string().required() // changed from 'name'
...
})
...
})
...