sul-dlss / sul_pub

SUL system for harvest and managing publications for Stanford CAP, with controlled API access.
http://cap.stanford.edu
Other
8 stars 3 forks source link

[sul_pub/prod] ArgumentError: struct size differs #1651

Closed justinlittman closed 9 months ago

justinlittman commented 9 months ago

Backtrace

line 39 of [PROJECT_ROOT]/lib/csl/citation.rb: new
line 39 of [PROJECT_ROOT]/lib/csl/citation.rb: citation_item
line 33 of [PROJECT_ROOT]/lib/csl/citation.rb: renderer

View full backtrace and more info at honeybadger.io

peetucket commented 9 months ago

Exemplar:

This is a publication that belongs to author id # 170880:

pub = Publication.find(225274) Csl::Citation.new(pub.pub_hash).citations

/opt/app/pub/sul-pub/shared/bundle/ruby/3.2.0/gems/citeproc-1.0.10/lib/citeproc/date.rb:83:in `initialize': struct size differs (ArgumentError)

csl_doc = Csl::Mapper.new(pub.pub_hash).csl_doc CiteProc::Item.new(csl_doc.deep_dup) /opt/app/pub/sul-pub/shared/bundle/ruby/3.2.0/gems/citeproc-1.0.10/lib/citeproc/date.rb:83:in `initialize': struct size differs (ArgumentError) csl_doc.delete('event-date') CiteProc::Item.new(csl_doc.deep_dup) => #

The fact that the csl_doc has "event-date"=>"1997-06-02T00:00:00" seems to be a problem.

peetucket commented 9 months ago

Problem seems to be here: https://github.com/sul-dlss/sul_pub/blob/main/lib/csl/mapper.rb#L78

In some specific cases, we are generating this in the csl-doc:

"event-date"=>"1997-06-02T00:00:00",

when we should be generating this:

"event-date"=>{"date-parts"=>[["1997-06-02T00:00:00"]]},

Problem seems to be here: https://github.com/sul-dlss/sul_pub/blob/main/lib/csl/mapper.rb#L78

See https://github.com/sul-dlss/sul_pub/blob/main/lib/csl/mapper.rb#L80-L83 for what it should be