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

Undefined method "utc" with "from" parameter #47

Open
bbpennel opened this issue Mar 21, 2024 · 0 comments
Open

Undefined method "utc" with "from" parameter #47

bbpennel opened this issue Mar 21, 2024 · 0 comments

Comments

@bbpennel
Copy link

In our hyrax 4 application, which is using blacklight-oai-provider 7.0.2, we are getting periodic errors like the following:

NoMethodError (undefined method `utc' for Sat, 04 Nov 2023:Date):
  
blacklight_oai_provider (7.0.2) lib/blacklight_oai_provider/resumption_token.rb:38:in `encode_conditions'
blacklight_oai_provider (7.0.2) lib/blacklight_oai_provider/resumption_token.rb:46:in `to_xml'
oai (1.2.1) lib/oai/provider/response/list_records.rb:37:in `block (2 levels) in to_xml'
builder (3.2.4) lib/builder/xmlbase.rb:176:in `_nested_structures'
builder (3.2.4) lib/builder/xmlbase.rb:69:in `tag!'
builder (3.2.4) lib/builder/xmlbase.rb:94:in `method_missing'
oai (1.2.1) lib/oai/provider/response/list_records.rb:26:in `block in to_xml'
oai (1.2.1) lib/oai/provider/response.rb:40:in `block in response'
builder (3.2.4) lib/builder/xmlbase.rb:176:in `_nested_structures'
builder (3.2.4) lib/builder/xmlbase.rb:69:in `tag!'
oai (1.2.1) lib/oai/provider/response.rb:37:in `response'
oai (1.2.1) lib/oai/provider/response/list_records.rb:25:in `to_xml'
oai (1.2.1) lib/oai/provider.rb:443:in `list_records'
oai (1.2.1) lib/oai/provider.rb:469:in `process_request'
blacklight_oai_provider (7.0.2) app/controllers/concerns/blacklight_oai_provider/controller.rb:18:in `oai'

which appear to occur when clients provide a from parameter specified as a date rather than a date+time, like the following:
/catalog/oai?verb=ListRecords&metadataPrefix=oai_dc&from=2023-11-04

The error only seems to occur if the result would return enough results to trigger resumption token behaviors. I'm not sure where it's happening in the stack, but it would seem that when the from (or until) field doesn't specify time of day, it gets deserialized as a Date, while when it is specified as a full UTC timestamp (with Z as the timezone) it gets deserialized as a DateTime. Only the latter has a utc method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant