relaton / relaton-un

UnBib: retrieve UN documents for bibliographic use using the BibliographicItem model
MIT License
1 stars 0 forks source link

(URGENT) Crash when fetching "UN/ECE" (which is not a document) #14

Open ronaldtse opened 7 months ago

ronaldtse commented 7 months ago
bundle exec relaton fetch "UN/ECE"
[relaton-un] (UN/ECE) Fetching from documents.un.org ...
bundler: failed to load command: relaton (/Users/mulgogi/.asdf/installs/ruby/3.2.2/bin/relaton)
relaton-un-1.18.0/lib/relaton_un/hit_collection.rb:88:in `page_resp': undefined method `[]' for nil:NilClass (NoMethodError)

      req = Net::HTTP::Post.new form.at("//form")[:action]
                                                 ^^^^^^^^^
gems/relaton-un-1.18.0/lib/relaton_un/hit_collection.rb:32:in `initialize'
gems/relaton-un-1.18.0/lib/relaton_un/un_bibliography.rb:10:in `new'
gems/relaton-un-1.18.0/lib/relaton_un/un_bibliography.rb:10:in `search'
gems/relaton-un-1.18.0/lib/relaton_un/un_bibliography.rb:43:in `isobib_search_filter'
gems/relaton-un-1.18.0/lib/relaton_un/un_bibliography.rb:26:in `get'
gems/relaton-un-1.18.0/lib/relaton_un/processor.rb:19:in `get'
gems/relaton-1.18.1/lib/relaton/db.rb:192:in `fetch_doc'
gems/relaton-1.18.1/lib/relaton/db.rb:494:in `net_retry'
gems/relaton-1.18.1/lib/relaton/db.rb:447:in `fetch_entry'
gems/relaton-1.18.1/lib/relaton/db.rb:435:in `new_bib_entry'
gems/relaton-1.18.1/lib/relaton/db.rb:407:in `check_bibliocache'
gems/relaton-1.18.1/lib/relaton/db.rb:69:in `fetch'
gems/relaton-cli-1.18.0/lib/relaton/cli/command.rb:186:in `fetch_document'
gems/relaton-cli-1.18.0/lib/relaton/cli/command.rb:37:in `fetch'
gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
gems/thor-hollaback-0.2.1/lib/thor/hollaback.rb:71:in `block in run'
gems/hollaback-0.1.1/lib/hollaback/sequence.rb:34:in `call'
gems/thor-hollaback-0.2.1/lib/thor/hollaback.rb:71:in `run'
gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
gems/relaton-cli-1.18.0/lib/relaton/cli.rb:57:in `start'
gems/relaton-cli-1.18.0/exe/relaton:20:in `<top (required)>'
bin/relaton:25:in `load'
bin/relaton:25:in `<top (required)>'
gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `load'
gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
gems/bundler-2.4.22/lib/bundler/cli/exec.rb:23:in `run'
gems/bundler-2.4.22/lib/bundler/cli.rb:492:in `exec'
gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
gems/bundler-2.4.22/lib/bundler/cli.rb:34:in `dispatch'
gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
gems/bundler-2.4.22/lib/bundler/cli.rb:28:in `start'
gems/bundler-2.4.22/exe/bundle:37:in `block in <top (required)>'
gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
gems/bundler-2.4.22/exe/bundle:29:in `<top (required)>'
andrew2net commented 7 months ago

@ronaldtse the relaton-un crashes when fetching anything because they have changed the authentication workflow. Before the changes, the hidden inputs were used to pass a token to a client. After the changes, the Javascript code takes a token somewhere and adds it to the header. I'm trying to understand where the token is taken.

andrew2net commented 7 months ago

The new authentication workflow uses a WebAssembly function that calculates tokens from the current date and time. The WebAssembly function has about 3000 lines of code and calls some JS functions back. I can't predict how long it may take to understand the algorithm and reproduce it in Ruby. So I temporarily disabled searching UN documents. For any UN references, this gem returns not found message.

$ relaton fetch "UN/ECE"
Resolving dependencies...
No matching bibliographic entry found
ronaldtse commented 7 months ago

@andrew2net let us just contact the UN Docs people and get a way to fetch.

opoudjis commented 7 months ago

Presumably related to this, https://github.com/metanorma/metanorma-ietf/issues/205

"UN/EDIFACT, D14.A" was failing to fetch, and now is returning an empty document. This is in the wild from a user.

ronaldtse commented 5 months ago

We are in contact with the UN Docs team to see how we can obtain access again.