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

Destroying record throws an exception in logs #9358

Open
BOHEUS opened this issue Jan 5, 2025 · 6 comments · May be fixed by #9719
Open

Destroying record throws an exception in logs #9358

BOHEUS opened this issue Jan 5, 2025 · 6 comments · May be fixed by #9719
Assignees

Comments

@BOHEUS
Copy link
Contributor

BOHEUS commented Jan 5, 2025

Scenario:

  1. Log in
  2. Go to Settings, toggle Advanced
  3. Go to API & Webhooks, add new webhook (for testing purposes use this site https://webhook.site)
  4. Go to Companies
  5. Delete 1 record
  6. Go to Deleted companies
  7. Select 1 records and destroy (permamently delete) record

Actual: Record is deleted permamently but in logs exception appears

Expected: Record is deleted permamently without exceptions/errors in logs

Logs:

Exception Captured
  undefined
  [
    Error: Error executing raw query for workspace 20202020-1c25-4d02-bf25-6aeccf7ea419: insert or update on table "timelineActivity" violates foreign key constraint "FK_814fbc70621668dca56cab9f9f5"
        at WorkspaceDataSourceService.executeRawQuery (/home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/engine/workspace-datasource/workspace-datasource.service.js:105:19)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async TimelineActivityService.upsertEvent (/home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/modules/timeline/services/timeline-activity.service.js:39:13)
        at async UpsertTimelineActivityFromInternalEvent.handle (/home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/modules/timeline/jobs/upsert-timeline-activity-from-internal-event.job.js:51:13)
        at async MessageQueueExplorer.invokeProcessMethods (/home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:111:17)
        at async MessageQueueExplorer.handleProcessor (/home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:105:13)
        at async /home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:79:17
        at async _bullmq.Worker [as processFn] (/home/user/Desktop/projects/twenty/packages/twenty-server/dist/src/engine/core-modules/message-queue/drivers/bullmq.driver.js:35:13)
        at async Worker.processJob (/home/user/Desktop/projects/twenty/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
        at async Worker.retryIfFailed (/home/user/Desktop/projects/twenty/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
  ]
@pacyL2K19
Copy link
Contributor

I can work on this @Bonapara

@pacyL2K19
Copy link
Contributor

I can't reproduce these logs @BOHEUS
Is it probably fixed? please have a look

@FelixMalfait
Copy link
Member

@pacyL2K19 It looks like it's trying to upsert a timeline activity on a deleted record. So maybe that can happen if your worker queue is full and the object has already been hard deleted by the time the event to be logged (e.g. a previous update) is processed by the worker queue? We should probably fail silently if it's been hard deleted?

@pacyL2K19
Copy link
Contributor

I get it
Yeah, failing silently may work in this scenario, I can work on an workaround

@FelixMalfait
Copy link
Member

Thanks @pacyL2K19!

@BOHEUS
Copy link
Contributor Author

BOHEUS commented Jan 13, 2025

@pacyL2K19 I still reproduce it, I forgot to add one step in scenario to make it easily reproducible, I'm sorry for that

@pacyL2K19 pacyL2K19 linked a pull request Jan 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants