Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgets not getting displayed after the user is logged in for a while. #98

Open
sandeep-ps opened this issue May 8, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@sandeep-ps
Copy link
Member

sandeep-ps commented May 8, 2024

Description

The widgets are not getting displayed after the user stays logged in for a while.

Steps to Repeat:

  1. Login to TORCHLITE dashboard
  2. Keep the browser tab open for a while (definitely more than 30 mins)
  3. Revisit the tab and see that the widgets are not visible.
  4. Refresh the page.
  5. See that the widgets are still not visible.

Expected Behavior

If the user session is active, the widgets should be displayed. If the user session has expired, the user needs to be promoted to sign back in.

Additional Context

  1. GET api/auth/session endpoint is returning HTTP 200, but in the response hints on a token refresh error.
{
    "user": {
        "name": "abc",
        "email": "xyz"
    },
    "expires": "2024-06-07T22:06:02.002Z",
    "sessionId": "<ID>",
    "error": "RefreshAccessTokenError"
}
  1. GET /api/worksets endpoint returning HTTP 500 after the user is logged in for a while. We need to check if the token refresh is happening correctly.
  2. Look into extending the life of refresh tokens to keep the user active for longer time.
@sandeep-ps sandeep-ps added the bug Something isn't working label May 8, 2024
@sandeep-ps sandeep-ps self-assigned this May 8, 2024
@sandeep-ps
Copy link
Member Author

Tested this twice using the Stage instance and waited 35 minutes and 50 minutes (in the issue description it's more than 30 minutes), but I couldn't reproduce this bug. I will try once more with a longer duration (more than 1 hour), and report back.

@jswatsch
Copy link

jswatsch commented Nov 7, 2024

@sandeep-ps will try a longer test now that the dev instance is working.

@jswatsch
Copy link

Will try once more today, but other tries were not reproducible.

@sandeep-ps
Copy link
Member Author

After waiting for more than a day, this issue looks reproducible.

There is error in the frontend logs:

    now: 1732054347
expires: 1732035809
Error: No session info found in the database for 4a50b278-e2db-477d-b31d-23671267fe65
    at o (/app/.next/server/pages/api/auth/[...nextauth].js:1:4243)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async y (/app/.next/server/pages/api/auth/[...nextauth].js:1:2102)
    at async Object.jwt (/app/.next/server/pages/api/auth/[...nextauth].js:1:3663)
    at async Object.session (/app/node_modules/next-auth/core/routes/session.js:44:21)
    at async AuthHandler (/app/node_modules/next-auth/core/index.js:136:27)
    at async NextAuthApiHandler (/app/node_modules/next-auth/next/index.js:18:19)
    at async NextAuth._args$ (/app/node_modules/next-auth/next/index.js:91:14)
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16881)
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17520)
DB: Deleting session 4a50b278-e2db-477d-b31d-23671267fe65
DB: Setting session expiration for session 4a50b278-e2db-477d-b31d-23671267fe65 on 2024-12-19T22:12:27.186Z
    now: 1732054347
expires: 1732035809
Error: No session info found in the database for 4a50b278-e2db-477d-b31d-23671267fe65
    at o (/app/.next/server/pages/api/auth/[...nextauth].js:1:4243)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async y (/app/.next/server/pages/api/auth/[...nextauth].js:1:2102)
    at async Object.jwt (/app/.next/server/pages/api/auth/[...nextauth].js:1:3663)
    at async Object.session (/app/node_modules/next-auth/core/routes/session.js:44:21)
    at async AuthHandler (/app/node_modules/next-auth/core/index.js:136:27)
    at async getServerSession (/app/node_modules/next-auth/next/index.js:129:19)
    at async d (/app/.next/server/pages/api/worksets.js:1:4402)
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16881)
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17520)
DB: Deleting session 4a50b278-e2db-477d-b31d-23671267fe65
DB: Setting session expiration for session 4a50b278-e2db-477d-b31d-23671267fe65 on 2024-12-19T22:12:27.388Z
Error: No session info found in the database for 4a50b278-e2db-477d-b31d-23671267fe65
    at o (/app/.next/server/pages/api/auth/[...nextauth].js:1:4243)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async d (/app/.next/server/pages/api/worksets.js:1:4462)
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16881)
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17520)
    at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:598:9)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:269:37)
    at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:817:17)
    at async invokeRender (/app/node_modules/next/dist/server/lib/router-server.js:173:21)
    at async handleRequest (/app/node_modules/next/dist/server/lib/router-server.js:350:24)

@sandeep-ps
Copy link
Member Author

We discussed to implement a fix by handling the KeyCloak response correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants