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

bugfix: escape destroyed objects on workers #9719

Merged

Conversation

pacyL2K19
Copy link
Contributor

This PR

@FelixMalfait please check this workaround

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR modifies event handling to prevent foreign key constraint violations when destroying records by filtering out events without 'after' properties before sending them to audit logs and timeline activities.

  • Fixed foreign key violation in packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/entity-events-to-db.listener.ts by adding event.properties.after check
  • Incorrect type annotations in handleDelete and handleDestroy methods using ObjectRecordUpdateEvent instead of ObjectRecordDeleteEvent
  • Unfiltered events still being sent to webhookQueueService could cause similar issues
  • Root cause of foreign key constraint violation may need deeper investigation rather than event filtering

💡 (5/5) You can turn off certain types of comments like style here!

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@pacyL2K19 pacyL2K19 force-pushed the bugfix/9358-exception-on-object-destroy branch from 8df2c41 to 2da33ca Compare January 20, 2025 11:14
@pacyL2K19 pacyL2K19 force-pushed the bugfix/9358-exception-on-object-destroy branch from 2da33ca to 9e515e8 Compare January 21, 2025 19:31
@pacyL2K19 pacyL2K19 force-pushed the bugfix/9358-exception-on-object-destroy branch from 6da3ae8 to 1017074 Compare January 23, 2025 06:48
@FelixMalfait FelixMalfait merged commit bbd3af1 into twentyhq:main Jan 23, 2025
30 checks passed
Copy link

Fails
🚫

node failed.

Log

�[31mError: �[39m SyntaxError: Unexpected token C in JSON at position 0
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:5555:27)�[39m
�[90m    at fullyReadBody (node:internal/deps/undici/undici:1665:9)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m
�[90m    at async specConsumeBody (node:internal/deps/undici/undici:5564:7)�[39m
danger-results://tmp/danger-results-5f2a9de4.json

Generated by 🚫 dangerJS against aac08a5

DeepaPrasanna pushed a commit to DeepaPrasanna/twenty that referenced this pull request Jan 27, 2025
# This PR

- Fixes twentyhq#9358 

@FelixMalfait please check this workaround

---------

Co-authored-by: Félix Malfait <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Destroying record throws an exception in logs
3 participants