appsmith
appsmith copied to clipboard
[Bug]: IndexOutOfBoundsException: Source emitted more than one item
Sentry Issue: APPSMITH-4EC
IndexOutOfBoundsException: Source emitted more than one item
at reactor.core.publisher.MonoSingle$SingleSubscriber.onNext(MonoSingle.java:134)
@hiteshjoshi @trishaanand seeing this crash in the update permissions flow
There are users in the DB which are assigned multiple roles in a workspace so update role is getting multiple roles to unassign. Crash can be fixed with PR but need to investigate how we reached at this point and what we can do to correct the data.
Used the following query to find such workspaces.
var map = function() {
if(this.defaultWorkspaceId != null)
emit(this.defaultWorkspaceId, this.assignedToUserIds);
};
var reduce = function(defaultWorkspaceId, assignedToUserIds) {
//2d array to 1d array
assignedToUserIds = [].concat.apply([], assignedToUserIds);
// set from array
var set = new Set(assignedToUserIds);
// if there are duplicates then length will be different
return assignedToUserIds.length !== set.size;
};
var filter = function(result) {
return result.value;
};
var transform = function(result) {
return result._id;
};
db.getCollection("permissionGroup").mapReduce(map, reduce, {"out": {"inline": 1}}).results.filter(filter).map(transform);
@infinitetrooper @trishaanand we're still seeing this issue
@trishaanand - Could this be the cause of the error Joseph tagged today as well?
https://theappsmith.slack.com/archives/CGBPVEJ5C/p1673802145166369
Closing as it's stale, reopen if the error reappears.