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

Staging: NoMethodError: undefined method `log_profile_event' for nil:NilClass #138

Open
crisr15 opened this issue Oct 26, 2022 · 9 comments
Assignees
Labels
bug Something isn't working Bulkrax

Comments

@crisr15
Copy link

crisr15 commented Oct 26, 2022

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.

@ShanaLMoore
Copy link
Contributor

May be fixed by #136

@DiemBTran
Copy link
Contributor

Related MRs:

@ShanaLMoore
Copy link
Contributor

ShanaLMoore commented Nov 22, 2022

We were hoping that this one would be resolved by #136 but I am still seeing this error in staging, after running an importer.

Image

@laritakr laritakr moved this from Ready for Development to In Development in utk-hyku Nov 22, 2022
@laritakr laritakr self-assigned this Nov 22, 2022
@ShanaLMoore
Copy link
Contributor

sample file to reproduce the above

gamble_good2_with_collections (1).csv

@ShanaLMoore
Copy link
Contributor

ShanaLMoore commented Nov 28, 2022

Attempt to resolve the log_profile error (error still occurs) : 9d7cb4b

@laritakr laritakr added Blocked and removed Blocked labels Nov 30, 2022
@laritakr
Copy link
Contributor

laritakr commented Dec 1, 2022

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:

#<Dry::Events::Event
id="object.metadata.updated"
payload={:object=>#<Hyrax::Work id=#<Valkyrie::ID:0x0000ffff8db0f8f0 @id="ea159c5f-0a02-4368-9f63-b3c0a9a4cedc"> internal_resource="#Class:0x0000ffff9c0845c0" created_at=Thu, 01 Dec 2022 18:52:22 +0000 updated_at=Thu, 01 Dec 2022 19:02:56 +0000 new_record=false alternate_ids=[#<Valkyrie::ID:0x0000ffff8db0f878 @id="ea159c5f-0a02-4368-9f63-b3c0a9a4cedc">] embargo=#<Hyrax::Embargo id=#<Valkyrie::ID:0x0000ffff8db45478 @id="ab9a69e6-4dc1-4a10-ab0d-7af8f88a7949"> internal_resource="Hyrax::Embargo" created_at=nil updated_at=nil new_record=true visibility_after_embargo=nil visibility_during_embargo=nil embargo_release_date=nil embargo_history=[]> lease=#<Hyrax::Lease id=#<Valkyrie::ID:0x0000ffff8db2f3a8 @id="83e5cbbd-3872-41a8-a74c-552fc3a3ee6d"> internal_resource="Hyrax::Lease" created_at=nil updated_at=nil new_record=true visibility_after_lease=nil visibility_during_lease=nil lease_expiration_date=nil lease_history=[]> title=["Keep waving his hand... the public is starting to get hostile!!"] date_modified=Thu, 01 Dec 2022 18:52:15 +0000 date_uploaded=Thu, 01 Dec 2022 18:52:15 +0000 depositor="[email protected]" admin_set_id=#<Valkyrie::ID:0x0000ffff8db0fad0 @id="admin_set/default"> member_ids=[] member_of_collection_ids=[#<Valkyrie::ID:0x0000ffff8db0fcb0 @id="a847a577-d5e7-492f-b63d-4239fdf2d220">] on_behalf_of=nil proxy_depositor=nil state=#<RDF::URI:0x79d10 URI:http://fedora.info/definitions/1/0/access/ObjState#active> rendering_ids=[] representative_id=#<Valkyrie::ID:0x0000ffff8db0fb70 @id=""> thumbnail_id=#<Valkyrie::ID:0x0000ffff8db0fb48 @id=""> has_model=nil create_date=nil modified_date=nil head=nil tail=nil arkivo_checksum=nil owner=nil bulkrax_identifier="gamble:1684" dynamic_schema_id="6" profile_version=1.0 label=nil keyword=nil based_near=nil utk_illustrator=nil utk_host_institution=nil utk_honoree=nil utk_former_owner=nil utk_engraver=nil utk_editor_of_compilation=nil utk_editor=nil utk_donor=nil utk_distributor=nil utk_designer=nil utk_depicted=nil utk_dedicatee=nil utk_creator=nil utk_costumer_designer=nil utk_correspondent=nil utk_copyright_holder=nil utk_contributor=nil utk_contractor=nil utk_composer=nil utk_compiler=nil utk_client=nil utk_cartographer=nil utk_autographer=nil utk_author=nil utk_attributed_name=nil utk_associated_name=nil utk_artist=nil utk_architect=nil translator=nil temporal=nil surveyor=nil subject=nil standards_body=nil stage_manager=nil stage_director=nil speaker=nil spatial_local=nil spatial=nil signer=nil sheetmusic_hostitem=nil set_designer=nil rights_statement=nil restorationist=nil resource_type=nil resource_link=nil repository=nil publisher=nil publication_place=nil provider=nil production_company=nil producer=nil printer_of_plates=nil printer=nil photographer=nil performer=nil other_version=nil originator=nil organizer=nil oclc=nil note=nil musical_director=nil music_copyist=nil lyricist=nil local_identifier=nil lithographer=nil license=nil language=nil issuing_body=nil is_part_of=nil interviewer=nil interviewee=nil intermediate_provider=nil instrumentalist=nil illustrator=nil host_institution=nil honoree=nil former_owner=nil form_local=nil form=nil extent=nil engraver=nil editor_of_compilation=nil editor=nil donor=nil distributor=nil designer=nil depicted=nil dedicatee=nil date_other_d=nil date_other=nil date_issued_d=nil date_issued=nil date_created_d=nil date_created=nil creator=nil costumer_designer=nil correspondent=nil copyright_holder=nil coordinates=nil contributor=nil contractor=nil composer=nil compiler=nil client=nil cartographer=nil bibliographic_citation=nil autographer=nil author=nil attributed_name=nil associated_name=nil artist=nil ark=nil archival_collection=nil architect=nil witness=nil videographer=nil utk_witness=nil utk_videographer=nil utk_translator=nil utk_surveyor=nil utk_standards_body=nil utk_stage_manager=nil utk_stage_director=nil utk_speaker=nil utk_signer=nil utk_set_designer=nil utk_restorationist=nil utk_publisher=nil utk_production_company=nil utk_producer=nil utk_printer_of_plates=nil utk_printer=nil utk_place_of_publication=nil utk_photographer=nil utk_performer=nil utk_owner=nil utk_originator=nil utk_organizer=nil utk_musical_director=nil utk_music_copyist=nil utk_lyricist=nil utk_lithographer=nil utk_issuing_body=nil utk_interviewer=nil utk_interviewee=nil utk_instrumentalist=nil alternative_title=nil acquisition_identifier=nil abstract=nil related_object_ids=[] file_ids=[] access_control_id=#<Valkyrie::ID:0x0000ffff8db0fb98 @id="20a0e4c3-dd05-4a73-a533-d9a943eae702"> access_control_id_id=nil representative_id_id=nil thumbnail_id_id=nil rendering_id_ids=[] admin_set_id_id=nil embargo_id=#<Valkyrie::ID:0x0000ffff8db0faa8 @id="ab9a69e6-4dc1-4a10-ab0d-7af8f88a7949"> embargo_id_id=nil lease_id=#<Valkyrie::ID:0x0000ffff8db0fa80 @id="83e5cbbd-3872-41a8-a74c-552fc3a3ee6d"> lease_id_id=nil>, :user=>nil}>

@laritakr
Copy link
Contributor

laritakr commented Dec 1, 2022

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.

@laritakr laritakr moved this from In Development to Code Review in utk-hyku Dec 1, 2022
@laritakr
Copy link
Contributor

laritakr commented Dec 1, 2022

Test by monitoring Sentry for error after a Bulkrax import which includes linking a work to a collection.

@laritakr laritakr moved this from Code Review to Deploy to Staging in utk-hyku Dec 2, 2022
@laritakr laritakr moved this from Deploy to Staging to SoftServ QA in utk-hyku Dec 2, 2022
@kirkkwang
Copy link
Contributor

kirkkwang commented Dec 5, 2022

✅ Did a test on a brand new tenant with:
gamble_good2_with_collections.1.csv

And did not observe any NoMethodErrors on the ContentUpdateEventJob

@kirkkwang kirkkwang moved this from SoftServ QA to Client QA in utk-hyku Dec 5, 2022
@kirkkwang kirkkwang moved this from Client QA to Done in utk-hyku Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Bulkrax
Projects
Status: Done
Development

No branches or pull requests

5 participants