Admin Login Requires Multiple Attempts
Dependency
- [x] #1474
- [ ] Retest this bug to ensure issue is still relevant before working on it.
Overview
The Admin login currently has a bug that returns a We don't recognize your email address. Please create an account. error when trying to login. Clicking login a second time without making any changes grants access. We need to ensure users are accurately being granted access with their first attempt.
Action Items
- [ ] Check #1323 to see if any of the completed issues resolved this one. If so, close this issue.
- [ ] Resolve the user authorization from needing two attempts to login.
- [ ] Check off your issue on #1323
See Error screenshot

Resources/Instructions
- Possible helpful paths:
- Client folder:
- Path:
context/authContext.jsLine 36 - Path:
hooks/useAuth.js
- Path:
@plang-psm those screenshots you took don't show which version of the site the error occured on
I have never seen it happen in local dev env
I also haven't been able to recreate it on dev.vrms.io even with inconito mode
It does definitely happen on vrms.io tho
@MattPereira
These errors occurred on vrms.io.
This is so weird but i've been trying to recreate the bug on Thursday March 16th on vrms.io from different browsers and devices and it doesn't seem like its occurring for the time being
I'm burnt out after a few hours on this one so I'm putting it back in the Prioritzied Backlog for now in case someone else is seeing something that I am not
So the bug just happened to me dev.vrms.io today which it wasnt doing yesterday :ghost:
Both dev.vrms.io and vrms.io are deployed using the same commit
Throwing this one back into the prioritized backlog until we get access to AWS.
Initial thoughts
It seems like it is hitting an error during the first login resulting in the user data to be null. This could explain why I received a null from console.logging checkUser (see the notes below).
The initial error set off a 502 error which could mean there is an issue with our AWS — we do not have access at this time see below.
If AWS is not the issue, we need to diagnose whether the checkUser or checkAuth is sending off the error.
if (userData) {
if (
userData.user.accessLevel !== ADMIN &&
userData.user.accessLevel === USER &&
userData.user.managedProjects.length === 0
) {
showError(
"You don't have the correct access level to view the dashboard"
);
return;
}
const isAuth = await checkAuth(email, LOG_IN);
if (isAuth) {
history.push('/emailsent');
} else {
showError(
'We don’t recognize your email address. Please, create an account.'
);
}
} else {
showError(
'We don’t recognize your email address. Please, create an account.'
);
}
Some notes below.
- Error does not occur on local but occurs on dev/prod.
- Cannot replicate the error in local and have had trouble recreating the error in dev/prod to debug but the initial issue sent off a 502 error which could possibly mean this is a server error
- To add to that, local does not use AWS like dev/prod. We do not have access to the correct VRMS AWS account and cannot verify this at this time.
- Also, there has been an error with our SSL cert as of recent
- I do recall putting a
console.logon checkUser and it returned null - All users keep receiving a 'We don’t recognize your email address. Please, create an account.' which is thrown twice in the Auth.js file. The first is in the
if(userData)usingcheckUserto pull the user data. The second is in theif(isAuth)which is usingcheckAuthto authorize a user via a boolean by checking if the user status code is equal to 200.

Resources
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-502-bad-gateway.html
@plang-psm stashing this in questions/review until we figure out what to do next
And leaving you assigned so you get credit for your hard work whenever this is ends up closed
Move this dependency
Retest this bug to ensure issue is still relevant before working on it. to the top action item