Open crisr15 opened 1 year ago
May be fixed by #136
Related MRs:
We were hoping that this one would be resolved by #136 but I am still seeing this error in staging, after running an importer.
sample file to reproduce the above
Attempt to resolve the log_profile error (error still occurs) : https://github.com/scientist-softserv/utk-hyku/commit/9d7cb4b5fe6502326ac08170663b08cc6ebf08c6
Narrowed down that this originates from the Bulkrax CreateRelationshipsJob.
Relevant Backtrace:
#8 #<Class:Hyrax::Collections::CollectionMemberService>.publish_metadata_updated(member#Image, user#NilClass) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:159
#9 #<Class:Hyrax::Collections::CollectionMemberService>.add_member(collection_id#String, new_member#Image, user#NilClass) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:111
#10 block in #<Class:Hyrax::Collections::CollectionMemberService>.block in add_members(collection_id#String, new_members#Enumerator, user#NilClass) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:86
#11 block in Wings::Valkyrie::QueryService.block in find_many_by_ids(ids#Array) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/lib/wings/valkyrie/query_service.rb:90
ͱ-- #12 Array.each at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/lib/wings/valkyrie/query_service.rb:88
#13 Wings::Valkyrie::QueryService.find_many_by_ids(ids#Array) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/lib/wings/valkyrie/query_service.rb:88
ͱ-- #14 Enumerator.each(*args) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:85
ͱ-- #15 Enumerable.map at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:85
#16 #<Class:Hyrax::Collections::CollectionMemberService>.add_members(collection_id#String, new_members#Enumerator, user#NilClass) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:85
#17 #<Class:Hyrax::Collections::CollectionMemberService>.add_members_by_ids(collection_id#String, new_member_ids#Array, user#NilClass) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/services/hyrax/collections/collection_member_service.rb:76
#18 Hyrax::CollectionBehavior.add_member_objects(new_member_ids#Array) at /usr/local/bundle/bundler/gems/hyrax-ce431a2c2823/app/models/concerns/hyrax/collection_behavior.rb:68
#19 Bulkrax::CreateRelationshipsJob.collection_parent_work_child at /usr/local/bundle/bundler/gems/bulkrax-181debef9aad/app/jobs/bulkrax/create_relationships_job.rb:86
#20 Bulkrax::CreateRelationshipsJob.create_relationships at /usr/local/bundle/bundler/gems/bulkrax-181debef9aad/app/jobs/bulkrax/create_relationships_job.rb:68
#21 Bulkrax::CreateRelationshipsJob.perform(parent_identifier#String, importer_run_id#Integer) at /usr/local/bundle/bundler/gems/bulkrax-181debef9aad/app/jobs/bulkrax/create_relationships_job.rb:57
Event at breakpoint:
id="object.metadata.updated"
payload={:object=>#<Hyrax::Work id=#<Valkyrie::ID:0x0000ffff8db0f8f0 @id="ea159c5f-0a02-4368-9f63-b3c0a9a4cedc"> internal_resource="#
This comes from the Bulkrax::CreateRelationships job.
The deprecation of the add_members method in collection_behavior routes to Hyrax::Collections::CollectionMemberService.add_members_by_ids, which expects a user, and passes nil by default. This means that the ObjectLifecycleListener receives an event with a nil user as it creates the ContentUpdateEventJob and throws a NoMethodError on the log_profile_event call for each collection member that is added.
I have verified that this is only a notifier and not an indication of a failure. Collection relationships were created appropriately in spite of this notification error.
This could potentially be solved by changing to call the Hyrax::Collections::CollectionMemberService.add_members_by_ids
directly in Bulkrax, but would limit which versions of Hyrax are supported. At this point, I am choosing to override hyrax to simply verify that we have a user before calling. Once Bulkrax uses the revised method, this override can be removed.
Test by monitoring Sentry for error after a Bulkrax import which includes linking a work to a collection.
✅ Did a test on a brand new tenant with: gamble_good2_with_collections.1.csv
And did not observe any NoMethodErrors
on the ContentUpdateEventJob
Why is depositor coming across as nil?
https://sentry.io/organizations/scientist-inc/issues/3597913959/?project=6745049&referrer=project-issue-stream
caused by running an importer.