eAPD
eAPD copied to clipboard
Update okta_users to remove unique from email
Describe the task here and link or add dependencies to any applicable issues... Okta does not restrict users to unique email addresses, so we should also remove that restriction
We also need to add logging for db errors that are a result of createOktaUser or updateOktaUser. We should wrap that section in a try/catch and log any errors that were thrown by the db. The status code for the error should be 512 so that those errors will be routed to slack.
const createOrUpdateOktaUser = (user_id, oktaUser, { db = knex } = {}) =>
getOktaUser(user_id, { db })
.then(user => {
if (!user) {
return createOktaUser(user_id, oktaUser, { db });
}
return updateOktaUser(user_id, oktaUser, { db });
})
.catch(e =>
logger.error({
message: `could not create or update user_id: ${user_id}`,
e
})
);
This task is done when...
- [ ] create a migration to remove the unique requirement from email in the okta_users table
- [ ] add try/catch to log errors with creating or updating users in okta_users