toeverything / AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
https://affine.pro
Other
41.05k stars 2.65k forks source link

No WorkspaceUserPermission found #7439

Open gcarrarom opened 3 months ago

gcarrarom commented 3 months ago

What happened?

My instance keeps returning empty workspace list for all users, even though I'm creating new workspaces and they appear in the Database just fine. Digging through the browser responses I see the 500 error trying to list the workspaces:

{"query":"\nquery getWorkspaces {\n  workspaces {\n    id\n    owner {\n      id\n    }\n  }\n}","operationName":"getWorkspaces"}

response:

{"errors":[{"message":"Internal Server Error","locations":[{"line":5,"column":5}],"path":["workspaces",0,"owner"],"extensions":{"code":"Internal Server Error","status":500}}],"data":null}

Distribution version

macOS x64 (Intel)

What browsers are you seeing the problem on if you're using web version?

Chrome, Firefox, Safari

Are you self-hosting?

Relevant log output

[Nest] 148  - 07/07/2024, 4:29:45 PM   ERROR [GraphQL] Internal server error
NotFoundError: No WorkspaceUserPermission found
    at /app/node_modules/@prisma/client/runtime/library.js:31:611
    at async /app/node_modules/@prisma/client/runtime/library.js:31:551
    at async WorkspaceResolver.owner (file:///app/dist/core/workspaces/resolvers/workspace.js:111:22)
    at async target (/app/node_modules/@nestjs/core/helpers/external-context-creator.js:74:28)

Anything else?

Version: 0.15.1

affine-issue-bot[bot] commented 3 months ago

Issue Status: 🏗 In Progress

🏗 In Progress

We’re currently working on the issue.

This is an automatic reply by the bot.

forehalo commented 3 months ago

you might join a workspace created by another user who's account got deleted but the workspace is still there.

plz check the WorkspaceUserPermission table to find the corresponding record of that deleted workspace and remove them all.

our logic of deleting account is not running perfectly. we will check it as well

gcarrarom commented 3 months ago

you might join a workspace created by another user who's account got deleted but the workspace is still there.

plz check the WorkspaceUserPermission table to find the corresponding record of that deleted workspace and remove them all.

our logic of deleting account is not running perfectly. we will check it as well

The workspace_user_permissions table has no entry with a workspace_id that doesn't exist in the workspaces table. I did find a workspace that doesn't have an entry on the workspace_user_permissions though.

I've then created an entry to try and add back that workspace with permissions, but no dice. Same error.