I have a react native application and I am trying to integrate AWS amplify to my project. Right now, I have collected all of the required infomraiton that I need to create an account. I have everything saves in state. WHen I try to actually signup and create an account, I run into an issue I have tried several time to fux but nothing seems to be working.
Here is my sugnupUser function:
import { signUp } from 'aws-amplify/auth'
const signupUser = () => {
signUp({
username: username,
password: password,
attributes: {
username: username,
email: email,
preferred_username: username,
phone_number: `+1${phone}`,
'custom:following': 0,
'custom:followers': 0,
'custom:favorites': 0
}
})
.then((response) => {
console.log('new user')
})
.catch((error) => {
console.log('error: ', error)
})
}
This is the error that I am getting:
LOG error: [InvalidParameterException: Attributes did not conform to the schema: name: The attribute is required
preferred_username: The attribute is required
email: The attribute is required
phone_number: The attribute is required
Here is the stored information in useState:
const [username, setUsername] = useState('')
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [verify, setVerify] = useState('')
const [name, setName] = useState('')
const [phone, setPhone] = useState('')
const [location, setLocation] = useState('')
Not sure why I keep getting this error or how to fix the error.