Users redirected to Login page periodically...

Using Github as our auth, we're seeing that there is some randomness to when users are redirected to the login page. Sometimes it will be tens of minutes after they logged in last, and othertimes they'll be logged in for a day. We also see them get the login page any time there is any kind of intermittent error in the coder backend. I'd like to have some more predictabiliity here... what can we do to tune the length of our developer login sessions and improve their resilience?
3 Replies
Codercord
Codercord4d ago
<#1365391419514294414>
Category
Help needed
Product
Coder (v2)
Platform
macOS
Logs
Please post any relevant logs/error messages.
Diranged
DirangedOP3d ago
This is incredibly frustrating for users... Here's an example of what just happened to me. 1. 6:42:06 - I logged in with a window and started poking around. 2. 6:42:37 - I used another window to go to the same endpoint... and I got prompted to log in! Why? Looking at the logs, we can see the order of operations:
2025-04-26 13:42:06.672 [info] coderd: audit_log ID=51d178b8-a09f-4aa0-81a4-e2cd997985fa ... Action=start Diff="{}" StatusCode=200 AdditionalFields="{\"workspace_name\":\"work\",\"build_number\":\"7\",\"build_reason\":\"initiator\",\"workspace_owner\":\"\",\"workspace_id\":\"1fc7b1c7-4b74-476e-9c65-6d2f831d5fcd\"}" RequestID=530623fc-2a7d-40cd-a33b-e7f6033a4065 ResourceIcon="" actor="&{ID:7f8d9aab-0472-4c99-bd89-3f836b4a8068 Email:xxx Username:diranged}"

2025-04-26 13:42:37.305 [warn] coderd: GET host=... path=/api/v2/updatecheck ... status_code=500 latency_ms=72 response_body="{\"message\":\"An internal server error occurred.\",\"detail\":\"pq: unable to read message kind\"}\n" request_id=b8ec8b09-d67f-484f-85fb-abcdf85fcc1d

2025-04-26 13:42:39.113 [info] coderd: audit_log ID=38a0f262-55a6-4c77-905f-8c3f482775a7 ... Action=logout Diff="{}" StatusCode=200 AdditionalFields="{}" RequestID=8f5ca26d-00e4-4438-8eeb-960e43c65f8b ResourceIcon="" actor="&{ID:7f8d9aab-0472-4c99-bd89-3f836b4a8068 Email:xxx Username:diranged}"
2025-04-26 13:42:06.672 [info] coderd: audit_log ID=51d178b8-a09f-4aa0-81a4-e2cd997985fa ... Action=start Diff="{}" StatusCode=200 AdditionalFields="{\"workspace_name\":\"work\",\"build_number\":\"7\",\"build_reason\":\"initiator\",\"workspace_owner\":\"\",\"workspace_id\":\"1fc7b1c7-4b74-476e-9c65-6d2f831d5fcd\"}" RequestID=530623fc-2a7d-40cd-a33b-e7f6033a4065 ResourceIcon="" actor="&{ID:7f8d9aab-0472-4c99-bd89-3f836b4a8068 Email:xxx Username:diranged}"

2025-04-26 13:42:37.305 [warn] coderd: GET host=... path=/api/v2/updatecheck ... status_code=500 latency_ms=72 response_body="{\"message\":\"An internal server error occurred.\",\"detail\":\"pq: unable to read message kind\"}\n" request_id=b8ec8b09-d67f-484f-85fb-abcdf85fcc1d

2025-04-26 13:42:39.113 [info] coderd: audit_log ID=38a0f262-55a6-4c77-905f-8c3f482775a7 ... Action=logout Diff="{}" StatusCode=200 AdditionalFields="{}" RequestID=8f5ca26d-00e4-4438-8eeb-960e43c65f8b ResourceIcon="" actor="&{ID:7f8d9aab-0472-4c99-bd89-3f836b4a8068 Email:xxx Username:diranged}"
I got logged it looks like due to a postgres connection error: pq: unable to read message kind
Phorcys
Phorcys2d ago
i'm not sure how you could tune session duration but this should not happen at all so even if you did it's most likely due to a server error are you using postgresql-ha? if yes, are you able to check that the multiple postgres nodes are on the same coalition version?

Did you find this page helpful?