twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
Other
23.14k stars 2.41k forks source link

Random crash and then logout #8347

Open chsasank opened 2 weeks ago

chsasank commented 2 weeks ago

I have deployed twenty using containers (but not using docker-compose). Here's an error I am getting once in a while:

Unexpected Application Error!
Scope id is not provided and cannot be found in context.

si@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:954:4652
hr@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:5845:5098
nOa@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:6229:517
jie@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:46:17091
hOe@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:48:44309
cOe@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:48:40008
Kmt@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:48:39931
gP@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:48:39776
UQ@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:48:36109
iOe@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:48:35054
C@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:33:1545
O@https://twenty.von-neumann.ai/assets/index-BqUDOfxQ.js:33:1903
image

I don't see any event in the server logs. What's frustrating about this crash is that I am getting logged out when I refresh the tab. It asks me to log in again.

chsasank commented 2 weeks ago

The relevant code seems to be here: https://github.com/twentyhq/twenty/blob/3793f6c4512bdf10efb7a4e51189f58dbf663ee0/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/hooks/__tests__/useAvailableScopeId.test.tsx#L12

chsasank commented 2 weeks ago

Containers themselves didn't restart either, just posting here for sanity:

(base) sasank@JOHNAIC:~/code/llama.lisp$ podman ps | grep twenty
db9c8c17e4ad  docker.io/library/redis:latest                     redis-server          30 hours ago  Up 30 hours  0.0.0.0:52951->3000/tcp                           systemd-twenty-redis
8ccd102a7806  docker.io/twentycrm/twenty-postgres:v0.31.2        /opt/bitnami/scri...  30 hours ago  Up 30 hours  0.0.0.0:52951->3000/tcp                           systemd-twenty-db
ca9b1da9d5fe  docker.io/twentycrm/twenty:v0.31.2                 sh /mnt/init_work...  30 hours ago  Up 30 hours  0.0.0.0:52951->3000/tcp                           systemd-twenty-worker
56a1c4ecb675  docker.io/twentycrm/twenty:v0.31.2                 node dist/src/mai...  26 hours ago  Up 26 hours  0.0.0.0:52951->3000/tcp                           systemd-twenty-server
harishnanthan commented 2 weeks ago

How can I reproduce this, @chsasank ? It will occur only when the'scopeId` is not found in context or props. It was used in many places, so I need to reproduce the steps.

chsasank commented 2 weeks ago

I use firefox if that helps. Unfortunately I don't have instructions to reliably reproduce. It just happened once in a while over last 2 days.

FelixMalfait commented 1 week ago

Thanks @chsasank - it's the second time I see a report with this message so we need to keep this issue open until we figure out what is going on. Unfortunately we've been trying to reproduce this internally but couldn't. Any hint appreciated! I will download Firefox but I think the other report was on Chrome

chsasank commented 1 week ago

I think it might be happening when I have logged in from a different browser. I think having second login is somehow expiring the first login and causing this.

chsasank commented 1 week ago

This is almost a clear pattern. Only single login seems to be possible. If I am logged in from multiple devices, it logs me out from one. If the tab is still open in a device that's to be logged out, this crash happens.

FelixMalfait commented 1 week ago

FYI I'm adding logs: https://github.com/twentyhq/twenty/pull/8513 ; it won't help short term but at least next time it comes after the next release and someone reports it, we might have more info