dwyl / bestevidence

:briefcase: City, University of London BestEvidence app
http://bestevidence.info/
11 stars 0 forks source link

Branded app internal server error with messaging #475

Open ajburls opened 5 years ago

ajburls commented 5 years ago

I created a client administrator and badged app for a hospital in Mexico www.BestEvidence.Info/HPS

He wrote to me to say

"When I click Messages there's an error: internal server error".

I have asked him for more details of what he was doing as the screenshot he sent (attached) didn't have the slug in it screenshot from giordano

I await to hear back from him, but whatever it was it shouldn't have happened.

iteles commented 5 years ago

Agreed, it’s odd he would have arrived at this page!

ajburls commented 5 years ago

@iteles He appears to have done everything correctly and is using a unique email address for his client admin emails. He helpfully sent the attached files. In the video the URL loses the slug when he goes to messages but the app itself still says it is the Hospital Pediatra Sinoa version.

image001

The MP4 video file he made won't attach here so I have sent it to you by email

RobStallion commented 5 years ago

@ajburls. Thanks for sending over the video. That is very helpful.

With regards to the point about the URL losing the slug. This is the correct behaviour of the site. Once a user has logged in, the branding information is taken from the user data, not the url.

Still looking into what is causing the internal server error.

iteles commented 5 years ago

@RobStallion Sounds like we could also do with a little update in the docs for branded apps and how they work for future reference 😊

RobStallion commented 5 years ago

I have created a new user for the hps account...

image

If I log in I get the hps branded version of the app as expected...

image

When I go to the messages page however I do not get an error. The site works as expected...

image

This leads me to believe that the error is to do with the particular user.

Next step is to look into what could cause an individual user to have an error.

RobStallion commented 5 years ago

Still not sure what is causing this user to error but after looking into this a little more is doesn't appear that this user is an admin.

When an admin clicks on the messages button in the nav-bar they should be taken to the /list-users endpoint...

image

I am going to make a clone of the database and work with it locally to see if I can spot anything relating to this particular user that could be causing them to have an error.

RobStallion commented 5 years ago

I have just managed to recreate the error locally

image

Looking into what is causing the issue now

RobStallion commented 5 years ago

The error is being caused because the struct being passed in is nil this users case.

Looking into where this is being called to see why the value is nil.

RobStallion commented 5 years ago

Found the cause of the bug. This particular user did not have a field in the user_messages_read table that related to them.

Looked into how this may have happened with @Danwhy but cannot see any reason for how this could have happened other than a database error.

Next steps