cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ojhaashish13
Community Member

Public JWKS URL is not working.

Jump to solution

I have configured the canvas on the ubuntu server by following the "production start" instruction. 

Production Start · instructure/canvas-lms Wiki · GitHub 

But when I am accessing the public JWKS URL https://canvas.pitchvantage.com/api/lti/security/jwks to access LTI 1.3 tool it is throwing this error while(1);{"errors":[{"message":"An error occurred.","error_code":"internal_server_error"}],"error_report_id":122}
When I am checking the error log it is saying "#122 undefined method `to_key' for nil:NilClass".

Please help me to fix the issue or guide me on how I can use the public JWKS URL for my LTI 1.3 Tool.

Note: I am using this LTI1.3 tool example on my localhost GitHub - IMSGlobal/lti-1-3-php-example-tool 

Tags (2)
1 Solution

Accepted Solutions
marcspringshare
Community Participant

I believe I finally find a solution here:
https://community.canvaslms.com/t5/Developers-Group/Canvas-LTI-1-3-Error-Unknown-Key-Type/m-p/390285...

The TLDR is that the Bitnami installation is missing the dynamic_settings.yml file, so I created one by copying the example file:
sudo cp /opt/bitnami/apps/canvaslms/htdocs/config/dynamic_settings.yml.example /opt/bitnami/apps/canvaslms/htdocs/config/dynamic_settings.yml

And then I added a "production" section to dynamic_settings.yml, containing the following:
production:
  store:
    canvas:
      lti-keys:
        jwk-past.json: {copy entire json object from the development section at the top of the file}
        jwk-present.json: {copy entire json object from the development section at the top of the file}
        jwk-future.json: {copy entire json object from the development section at the top of the file}

Restarting the Bitnami services after making that change seems to have resolved things:
sudo /opt/bitnami/ctlscript.sh restart

Hope that saves someone else some time!

View solution in original post

3 Replies
marcspringshare
Community Participant

I am having the same issue:

[bad2d12f27a227b91626530c7e2e5c0e 8b25889c-7cc5-4712-82f9-9bdbd10d2491] Started GET "/api/lti/security/jwks" for {my_ip_address} at 2020-11-16 16:45:56 +0000
[bad2d12f27a227b91626530c7e2e5c0e 8b25889c-7cc5-4712-82f9-9bdbd10d2491] Redis (0.301ms) get settings_for_plugin4/sessions [127.0.0.1:6379]
[bad2d12f27a227b91626530c7e2e5c0e 8b25889c-7cc5-4712-82f9-9bdbd10d2491] request throttling increment: [0,50.0,1605545156.054561,["client_identifier","user:10000000000001"],["count",0.0],["last_touched",null]]
[bad2d12f27a227b91626530c7e2e5c0e 8b25889c-7cc5-4712-82f9-9bdbd10d2491] Redis (0.371ms) evalsha - [127.0.0.1:6379]
[bad2d12f27a227b91626530c7e2e5c0e 8b25889c-7cc5-4712-82f9-9bdbd10d2491] Processing by Lti::Ims::SecurityController#jwks as JSON
[bad2d12f27a227b91626530c7e2e5c0e 8b25889c-7cc5-4712-82f9-9bdbd10d2491]
NoMethodError (undefined method `to_key' for nil:NilClass
Did you mean? to_query):
/opt/bitnami/apps/canvaslms/htdocs/lib/canvas/security/key_storage.rb:60:in `block in public_keyset'
/opt/bitnami/apps/canvaslms/htdocs/lib/canvas/security/key_storage.rb:59:in `map'
/opt/bitnami/apps/canvaslms/htdocs/lib/canvas/security/key_storage.rb:59:in `public_keyset'
/opt/bitnami/apps/canvaslms/htdocs/app/controllers/lti/ims/security_controller.rb:51:in `jwks'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/abstract_controller/base.rb:194:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/app/controllers/application_controller.rb:561:in `compute_http_cost'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/app/controllers/application_controller.rb:578:in `report_to_datadog'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/inst_statsd-2.1.6/lib/inst_statsd/statsd.rb:95:in `batch'
/opt/bitnami/apps/canvaslms/htdocs/app/controllers/application_controller.rb:556:in `batch_statsd'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/lib/temp_cache.rb:28:in `enable'
/opt/bitnami/apps/canvaslms/htdocs/app/controllers/application_controller.rb:552:in `enable_request_cache'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/app/controllers/application_controller.rb:546:in `set_locale'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:136:in `run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/notifications.rb:168:in `block in instrument'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/notifications.rb:168:in `instrument'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/abstract_controller/base.rb:134:in `process'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionview-5.2.4.3/lib/action_view/rendering.rb:32:in `process'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal.rb:191:in `dispatch'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_controller/metal.rb:252:in `dispatch'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/journey/router.rb:35:in `each'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/journey/router.rb:35:in `serve'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/routing/route_set.rb:840:in `call'
/opt/bitnami/apps/canvaslms/htdocs/gems/plugins/respondus_soap_endpoint/lib/respondus_soap_endpoint/middleware.rb:78:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/deflater.rb:44:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/chunked.rb:98:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/request_throttle.rb:64:in `block in call'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/request_throttle.rb:332:in `reserve_capacity'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/request_throttle.rb:59:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/request_context_session.rb:25:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/load_account.rb:29:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:98:in `run_callbacks'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/rack/logger.rb:38:in `call_app'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/rack/logger.rb:28:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/request_context_generator.rb:49:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
/opt/bitnami/apps/canvaslms/htdocs/app/middleware/prevent_non_multipart_parse.rb:33:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/engine.rb:524:in `call'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/railtie.rb:190:in `public_send'
/opt/bitnami/apps/canvaslms/htdocs/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.3/lib/rails/railtie.rb:190:in `method_missing'
/opt/bitnami/ruby/lib/ruby/gems/2.5.0/gems/passenger-6.0.5/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:107:in `process_request'
/opt/bitnami/ruby/lib/ruby/gems/2.5.0/gems/passenger-6.0.5/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
/opt/bitnami/ruby/lib/ruby/gems/2.5.0/gems/passenger-6.0.5/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
/opt/bitnami/ruby/lib/ruby/gems/2.5.0/gems/passenger-6.0.5/src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
/opt/bitnami/ruby/lib/ruby/gems/2.5.0/gems/passenger-6.0.5/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'

Filling in some more info as I go.  Hopefully this will help others in the future:

You can view the details of an error report by visiting /error_reports/{error_report_id} off your Canvas domain.

The specific error I am seeing in the /opt/bitnami/apps/canvaslms/htdocs/log/production.log is "undefined method `sign' for nil:NilClass".  A similar error is reported at https://community.canvaslms.com/t5/Developers-Group/Canvas-LTI-1-3-Integration-Issues/m-p/228717/hig... with a suggestion that it may be related to an inability to read from (REDIS) cache.

@jpoulosis your suggestion above WRT verifying the REDIS config still correct for this issue? If so, do you have any commands you may have shared with the original poster from that thread that could be useful to me as well?

marcspringshare
Community Participant

I believe I finally find a solution here:
https://community.canvaslms.com/t5/Developers-Group/Canvas-LTI-1-3-Error-Unknown-Key-Type/m-p/390285...

The TLDR is that the Bitnami installation is missing the dynamic_settings.yml file, so I created one by copying the example file:
sudo cp /opt/bitnami/apps/canvaslms/htdocs/config/dynamic_settings.yml.example /opt/bitnami/apps/canvaslms/htdocs/config/dynamic_settings.yml

And then I added a "production" section to dynamic_settings.yml, containing the following:
production:
  store:
    canvas:
      lti-keys:
        jwk-past.json: {copy entire json object from the development section at the top of the file}
        jwk-present.json: {copy entire json object from the development section at the top of the file}
        jwk-future.json: {copy entire json object from the development section at the top of the file}

Restarting the Bitnami services after making that change seems to have resolved things:
sudo /opt/bitnami/ctlscript.sh restart

Hope that saves someone else some time!

View solution in original post