-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
PATCH for groups returns 500 when members are updated #731
Comments
I quickly checked the Nuget Package EFCore.BulkExtensions, which is used by SimpleIdServer for bulk data insertion. In the EFSCIMRepresentationCommandRepository class, could you please update the methods BulkInsert, BulkDelete, and BulkUpdate to capture the error messages originating from the MySQLConnection? The code should resemble something like this:
If this is too challenging, could you monitor and provide the incoming HTTP request that triggers this issue? I will attempt to reproduce the problem. |
Hi @simpleidserver ! Thanks a lot for the recommendation! I spent some time previously to set up test environment local to reproduce the issue and I included library directly. So the error it the following:
I assume it is related to the order of bulk insert: As you can see, the list of inserted attributes is the following: It seems the groups attribute itself is the last in groups.* sub attributes set. I think groups and members.type attributes are set successfully, but sub attributes of user's groups property fails because it tries to insert it before. P.s. var attributesToInsert = scimRepresentationAttributes.ToList(); |
So, i've made this small hack to test my theory: var attributesToInsert = scimRepresentationAttributes.OrderBy(x => x.ParentAttributeId).ToList(); It placed groups before related sub-properties. And it worked. If you could suggest me, where is better to fix ordering, I could prepare an MR with more correct fix |
Thank you for the information :) I'll take a look and fix this issue for the next release! |
Great! You can submit the pull request with this fix :) |
So, I think I found where it is better to make this fix. I think in RepresentationReferenceSync.BuildScimRepresentationAttribute we should return parent not the last, but the first. I can prepare MR a little bit later |
fix(#731): attributes ordering on insert
This issue is fixed in the version 5.0.0 |
Hello team!
I faced strange issue. For some groups on SCIM PATCH server returns 500 error.
In logs the following error is shown: 5 rows were copied to scim.SCIMRepresentationAttributeLst but only 2 were inserted.
The detailed stack trace:
MySqlConnector.MySqlException (0x80004005): 5 rows were copied to scim.SCIMRepresentationAttributeLst but only 2 were inserted.
at MySqlConnector.MySqlBulkCopy.WriteToServerAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/MySqlBulkCopy.cs:line 347
at MySqlConnector.MySqlBulkCopy.WriteToServerAsync(DataTable dataTable, CancellationToken cancellationToken) in //src/MySqlConnector/MySqlBulkCopy.cs:line 148
at EFCore.BulkExtensions.SqlAdapters.MySql.MySqlAdapter.InsertAsync[T](DbContext context, Type type, IEnumerable
1 entities, TableInfo tableInfo, Action
1 progress, Boolean isAsync, CancellationToken cancellationToken)at EFCore.BulkExtensions.SqlAdapters.MySql.MySqlAdapter.InsertAsync[T](DbContext context, Type type, IEnumerable
1 entities, TableInfo tableInfo, Action
1 progress, Boolean isAsync, CancellationToken cancellationToken)at EFCore.BulkExtensions.SqlAdapters.MySql.MySqlAdapter.InsertAsync[T](DbContext context, Type type, IEnumerable
1 entities, TableInfo tableInfo, Action
1 progress, CancellationToken cancellationToken)at EFCore.BulkExtensions.SqlBulkOperation.InsertAsync[T](DbContext context, Type type, IEnumerable
1 entities, TableInfo tableInfo, Action
1 progress, CancellationToken cancellationToken)at EFCore.BulkExtensions.DbContextBulkTransaction.ExecuteAsync[T](DbContext context, Type type, IEnumerable
1 entities, OperationType operationType, BulkConfig bulkConfig, Action
1 progress, CancellationToken cancellationToken)at SimpleIdServer.Scim.Commands.Handlers.PatchRepresentationCommandHandler.UpdateRepresentation(SCIMRepresentation existingRepresentation, PatchRepresentationCommand patchRepresentationCommand, SCIMSchema schema)
at SimpleIdServer.Scim.Commands.Handlers.PatchRepresentationCommandHandler.UpdateRepresentation(SCIMRepresentation existingRepresentation, PatchRepresentationCommand patchRepresentationCommand, SCIMSchema schema)
SCIM Provider: Azure AD
Database: MySQL 8.0 (AWS Aurora MySQL to be specific)
Entity Framework Provider: Pomelo.EntityFrameworkCore.MySql
SimpleIdServer Version: 4.0.8
Could you please take a look at it?
Please let me know, if more information should be provided.
The text was updated successfully, but these errors were encountered: