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

Can't delete an account #9232

Closed
BOHEUS opened this issue Dec 25, 2024 · 0 comments · Fixed by #9238
Closed

Can't delete an account #9232

BOHEUS opened this issue Dec 25, 2024 · 0 comments · Fixed by #9238

Comments

@BOHEUS
Copy link
Contributor

BOHEUS commented Dec 25, 2024

Scenario:

  1. Log in
  2. Go to Settings > Profile
  3. Click "Delete account" button
  4. Type placeholder and confirm

Actual: User is not redirected to login page and error appears in both UI and logs
Image

Expected: Account is deleted and user is redirected to login page

Logs: (in logs first and last name are empty even though they're visible in Members tab)

[Nest] 19690  - 12/25/2024, 10:48:54 AM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'dataSourceService')
TypeError: Cannot read properties of undefined (reading 'dataSourceService')
    at map (/home/user/Desktop/projects/twenty/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts:83:18)
    at Array.map (<anonymous>)
    at UserService.deleteUser (/home/user/Desktop/projects/twenty/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts:139:39)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Exception Captured
  {
    operation: { name: 'DeleteUserAccount', type: 'mutation' },
    document: 'mutation DeleteUserAccount {\n  deleteUser {\n    id\n    __typename\n  }\n}',
    user: User {
      id: '0b1bdcb9-44d1-47d1-904c-1059a678396a',
      firstName: '',
      lastName: '',
      email: '[email protected]',
      defaultAvatarUrl: null,
      emailVerified: false,
      disabled: false,
      passwordHash: '$2b$10$Z.qDzACiqke/kQJwXY8KceA3D4qGqYkh7Yv1uU.KgnhNk.Uq9YpNm',
      canImpersonate: false,
      createdAt: 2024-12-25T09:48:21.336Z,
      updatedAt: 2024-12-25T09:48:21.336Z,
      deletedAt: null
    },
    workspace: {
      id: '20202020-1c25-4d02-bf25-6aeccf7ea419',
      displayName: 'Apple',
      createdAt: '2024-12-25T09:46:11.913Z',
      activationStatus: 'ACTIVE'
    }
  }
  [
    TypeError: Cannot read properties of undefined (reading 'dataSourceService')
        at map (/home/user/Desktop/projects/twenty/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts:83:18)
        at Array.map (<anonymous>)
        at UserService.deleteUser (/home/user/Desktop/projects/twenty/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts:139:39)
        at processTicksAndRejections (node:internal/process/task_queues:95:5) {
      path: undefined,
      locations: undefined,
      extensions: {
        code: 'INTERNAL_SERVER_ERROR',
        response: "Cannot read properties of undefined (reading 'dataSourceService')"
      }
    }
  ]
Weiko added a commit that referenced this issue Jan 2, 2025
### Summary

This pull request addresses the issue described in #9232, where
attempting to delete a user account results in a `TypeError: Cannot read
properties of undefined (reading 'dataSourceService')`.

### Changes Made

- Fixed the `this` context issue in the `deleteUserFromWorkspace` method
by ensuring it is correctly bound.
- Updated the `deleteUser` method to use a bound function when calling
`deleteUserFromWorkspace`.

### Linked Issue

This pull request fixes #9232.

### Additional Notes

- Please review the changes carefully to ensure no unintended side
effects in the user or workspace deletion process.
- Suggestions for further improvement are welcome.

---------

Co-authored-by: Lucas Bordeau <[email protected]>
Co-authored-by: Weiko <[email protected]>
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Product development ✅ Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant