twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.77k stars 1.72k forks source link

Blank screen after restarting the CRM. found "INTERNAL_SERVER_ERROR", "response": "Token has expired." on network tab #6648

Closed Rounak826 closed 1 week ago

Rounak826 commented 3 weeks ago

Bug Description

A blank screen appears after successful login and restarting the CRM due to an expired token.

Network Tab

    "errors": [
        {
            "message": "Error",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "response": "Token has expired."
            }
        }
    ]
}```
Server Logs
```Exception Captured
  { user: undefined }
  [
    AuthException [Error]: Token has expired.
        at TokenService.verifyJwt (/app/packages/twenty-server/dist/src/engine/core-modules/auth/services/token.service.js:367:23)
        at TokenService.validateToken (/app/packages/twenty-server/dist/src/engine/core-modules/auth/services/token.service.js:175:36)
        at GraphQLHydrateRequestFromTokenMiddleware.use (/app/packages/twenty-server/dist/src/engine/middlewares/graphql-hydrate-request-from-token.middleware.js:49:44)
        at /app/node_modules/@nestjs/core/router/router-proxy.js:9:23
        at Layer.handle [as handle_request] (/app/node_modules/@nestjs/platform-express/node_modules/express/lib/router/layer.js:95:5)
        at next (/app/node_modules/@nestjs/platform-express/node_modules/express/lib/router/route.js:144:13)
        at next (/app/node_modules/@nestjs/platform-express/node_modules/express/lib/router/route.js:140:7)
        at next (/app/node_modules/@nestjs/platform-express/node_modules/express/lib/router/route.js:140:7)
        at next (/app/node_modules/@nestjs/platform-express/node_modules/express/lib/router/route.js:140:7)
        at next (/app/node_modules/@nestjs/platform-express/node_modules/express/lib/router/route.js:140:7) {
      code: 'FORBIDDEN_EXCEPTION'
    }
  ]

Expected behavior

Handle expired tokens gracefully and prompt users to log in again or refresh the token internally

Technical inputs

raphspeaks commented 3 weeks ago

I’ve experienced the same thing. The stale token breaks the front end. When this happens you’ll see an error in the bottom right hand screen. I would expect that the application would route to a login screen, but instead it’s just blank.

Rounak826 commented 3 weeks ago

I have found a temporary workaround to log into my account by navigating to the application section in the inspect window and manually deleting the token. but it's very frustrating. The worst part is my non-tech team can't access the CRM.

tldev-de commented 3 weeks ago

as temporary workaround for non-techs, you can tell them to use an "incognito window" / "private window" each time, they get the white page. not really a great solution, but a workaround until the issue is fixed.

Rounak826 commented 3 weeks ago

Yes, that's the only option for now. I hope this issue gets fixed soon

agerman77 commented 3 weeks ago

You have to delete the tokenPair cookie manually. Any workaround for this?

image

Rounak826 commented 3 weeks ago

as temporary workaround for non-techs, you can tell them to use an "incognito window" / "private window" each time, they get the white page. not really a great solution, but a workaround until the issue is fixed.

as @tldev-de mentioned avoid using normal tab and use incognito / private tab. if you have already logged in using the normal tab clear the cookies before using incognito.

charlesBochet commented 1 week ago

This has been fixed in 0.24, closing :)