ncbo / bioportal_web_ui

A Rails application for biological ontologies
http://bioportal.bioontology.org/
Other
21 stars 2 forks source link

Rails application can't boot in production because of IssueCreatorService #283

Closed syphax-bouazzouni closed 8 months ago

syphax-bouazzouni commented 10 months ago

Description

In our latest deployment, we got the below error from the IssueCreatorService, we are synced with the release v6.9.0

The issue seems that the GitHub::Client.parse line raises an error, but really clear what is it about.

The way I fixed it temporarily in our code, is to remove the two constants FindRepoQuery and CreateIssueMutation, and put them as variables in the call method call.

Log

App 17249 output: Error: The application encountered the following error: undefined method `[]' for nil:NilClass (NoMethodE
rror)
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-client-0.18.0/lib/graphql/clie
nt/query_typename.rb:28:in `add_typename'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-client-0.18.0/lib/graphql/clie
nt/query_typename.rb:48:in `on_operation_definition'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:95:in `on_operation_definition_with_modifications'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:121:in `public_send'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:121:in `block in on_document_children'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:119:in `each'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:119:in `on_document_children'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:84:in `on_document'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:95:in `on_document_with_modifications'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:53:in `public_send'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-2.1.0/lib/graphql/language/vis
itor.rb:53:in `visit'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-client-0.18.0/lib/graphql/clie
nt/query_typename.rb:62:in `insert_typename_fields'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/shared/bundle/ruby/2.7.0/gems/graphql-client-0.18.0/lib/graphql/clie
nt.rb:189:in `parse'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/releases/20230912033533/app/services/issue_creator_service.rb:6:in `<class:IssueCreatorService>'
App 17249 output:     /srv/ontoportal/bioportal_web_ui/releases/20230912033533/app/services/issue_creator_service.rb:3:in `<top (required)>'
jvendetti commented 10 months ago

I'm having trouble reproducing this on our end. The 6.9.0 release added support for ontology change requests, hence the issue creator service for generating issues into external GitHub repositories.

The Rails server boots without errors in appliance mode:

➜  bioportal_web_ui git:(master) ✗ rails s -e appliance
=> Booting Thin
=> Rails 6.1.7.3 application starting in appliance http://0.0.0.0:3000
=> Run `bin/rails server --help` for more startup options
2023-09-12 18:02:03 -0700 Thin web server (v1.8.2 codename Ruby Razor)
2023-09-12 18:02:03 -0700 Maximum connections set to 1024
2023-09-12 18:02:03 -0700 Listening on 0.0.0.0:3000, CTRL+C to stop

I also checked with @alexskr about this, and he mentioned that he hadn't run into any issues with the last OntoPortal release, which was based on the v6.11.0 tag.

Though, I suppose that you aren't running AgroPortal in "appliance" mode?

jvendetti commented 8 months ago

This issue was recently reproduced in our staging environment. It was caused when the graphql transitive dependency was upgraded from 2.0.26 to 2.1.0. Version 2.1.0 of graphql breaks graphql-client. The current resolution is to pin graphql to something less than 2.1, e.g., see this commit: https://github.com/ncbo/bioportal_web_ui/commit/23e681eb1c9c851a82de2e00d45b5f0157b0a849.

Leaving this open for the moment because the fix isn't deployed to production just yet - only the staging environment.

jvendetti commented 8 months ago

Fixed by this commit: https://github.com/ncbo/bioportal_web_ui/commit/23e681eb1c9c851a82de2e00d45b5f0157b0a849, and deployed/verified in production.