-
Notifications
You must be signed in to change notification settings - Fork 13k
regression: Room update via apps engine failing with Duplicated index key error
#35878
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
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release-7.6.0 #35878 +/- ##
================================================
Coverage ? 61.09%
================================================
Files ? 3005
Lines ? 71433
Branches ? 16369
================================================
Hits ? 43643
Misses ? 24824
Partials ? 2966
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
Issue(s)
https://rocketchat.atlassian.net/browse/CTZ-86
Steps to test or reproduce
When an app (like WhatsApp) adds custom fields to the room, it issues an update via bridge with just the necessary data (in this case, the _id and customFields props).
When the apps engine receives this, it triest to convert that into a rocketchat room object, assuming some properties are there. Since, in this case, the
namewas not in the original update, then it defaulted toundefined, leaving the update statement with something like:Previously, the driver would ignore those undefined fields, but now we're passing them into the query. This caused the room to be
name: undefinedin the database (apart from other fields, like the room'stype!)Then, when another update or another query to the room was made, the app wasn't able to find the room it creatd (as it lacked the type
lfor livechat) and it attempted to create a new one. Then, when it added the custom fields, the same would happen, but this time, it would conflict with the previous room as both would havename: undefinedon the database (and name should be unique).This would throw a Duplicated Index Key error, which the apps engine would fail to parse, causing the whole operation to fail and the gateway to reschedule the message...
Further comments
Caused by #31497
(Or at least, this one made it surface :p )