LTI App - bad URI(is not URI?)

124 views
Skip to first unread message

Josh Kraemer

unread,
Apr 14, 2016, 4:01:52 PM4/14/16
to Canvas LMS Users
Hi,

I am getting this error on my ProctorU LTI app when upgrading to the 4-2-2016 stable release of Canvas. I know there isn't a problem with the LTI app itself because I was able to get it working on a new installation of Canvas. I've rebased the code and ensured all of the yml files under canvas/config are update to date with the stable release. Beyond that and a couple of images, there are no other customizations that I've done to production Canvas code.

Any ideas?

category: URI::InvalidURIError
created at: 2016-04-14 13:21:09 -0500
request context id: d1bf3113-4f45-4fa4-a728-d5aa7c5450b8 
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
HTTP_ACCEPT_ENCODING: gzip, deflate 
HTTP_HOST: canvasdomain.com 
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17 
PATH_INFO: /courses/5/external_tools/77 
QUERY_STRING: ? 
REMOTE_ADDR: 99.102.18.59 
REQUEST_METHOD: GET 
SERVER_NAME: canvasdomain.com 
SERVER_PORT: 443 
SERVER_PROTOCOL: HTTP/1.1 
format: text/html 
hostname: canvas-application 
path_parameters: {:action=>"show", :controller=>"external_tools", :course_id=>"5", :id=>"77"} 
pid: 4286 
query_parameters: {} 
request_parameters: {} 
response_code: 500 
type: 

        bad URI(is not URI?):  https://api.proctoru.com/lti/login
/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/uri/rfc3986_parser.rb:66:in `split' /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/uri/rfc3986_parser.rb:72:in `parse' /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/uri/common.rb:226:in `parse' /home/collegeplus/canvas/gems/lti_outbound/lib/lti_outbound/tool_launch.rb:167:in `generate_params' /home/collegeplus/canvas/gems/lti_outbound/lib/lti_outbound/tool_launch.rb:130:in `generate' /home/collegeplus/canvas/app/models/lti/lti_outbound_adapter.rb:63:in `generate_post_payload' /home/collegeplus/canvas/app/controllers/external_tools_controller.rb:418:in `basic_lti_launch_request' /home/collegeplus/canvas/app/controllers/external_tools_controller.rb:403:in `lti_launch' /home/collegeplus/canvas/app/controllers/external_tools_controller.rb:323:in `show' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/implicit_render.rb:4:in `send_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/base.rb:189:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rendering.rb:10:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:585:in `block (2 levels) in _run__625901974439998155__process_action__callbacks' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:212:in `block in _conditional_callback_around_533' /home/collegeplus/canvas/app/controllers/application_controller.rb:287:in `block in enable_request_cache' /home/collegeplus/canvas/lib/temp_cache.rb:7:in `enable' /home/collegeplus/canvas/app/controllers/application_controller.rb:286:in `enable_request_cache' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:211:in `_conditional_callback_around_533' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:424:in `block in _run__625901974439998155__process_action__callbacks' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:212:in `block in _conditional_callback_around_534' /home/collegeplus/canvas/app/controllers/application_controller.rb:280:in `set_locale' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:211:in `_conditional_callback_around_534' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:423:in `_run__625901974439998155__process_action__callbacks' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:80:in `run_callbacks' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/callbacks.rb:17:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rescue.rb:29:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications.rb:159:in `block in instrument' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications.rb:159:in `instrument' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:30:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/base.rb:136:in `process' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/rendering.rb:44:in `process' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-mini-profiler-0.9.2/lib/mini_profiler/profiling_methods.rb:79:in `block in profile_method' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal.rb:195:in `dispatch' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal.rb:231:in `block in action' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:82:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:82:in `dispatch' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:50:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/journey/router.rb:71:in `block in call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/journey/router.rb:59:in `each' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/journey/router.rb:59:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:676:in `call' /home/collegeplus/canvas/gems/plugins/respondus_soap_endpoint/lib/respondus_soap_endpoint/middleware.rb:61:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/etag.rb:23:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/conditionalget.rb:25:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/head.rb:11:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/params_parser.rb:27:in `call' /home/collegeplus/canvas/app/middleware/request_throttle.rb:59:in `block in call' /home/collegeplus/canvas/app/middleware/request_throttle.rb:257:in `reserve_capacity' /home/collegeplus/canvas/app/middleware/request_throttle.rb:54:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/flash.rb:241:in `call' /home/collegeplus/canvas/app/middleware/request_context_session.rb:25:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/session/abstract/id.rb:225:in `context' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/session/abstract/id.rb:220:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/encrypted_cookie_store-instructure-1.1.12/lib/encrypted_cookie_store.rb:47:in `call' /home/collegeplus/canvas/app/middleware/sessions_timeout.rb:22:in `call' /home/collegeplus/canvas/app/middleware/load_account.rb:12:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/cookies.rb:486:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/query_cache.rb:36:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:373:in `_run__4005537150346334818__call__callbacks' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:80:in `run_callbacks' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/remote_ip.rb:76:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/railties-4.0.13/lib/rails/rack/logger.rb:38:in `call_app' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/railties-4.0.13/lib/rails/rack/logger.rb:22:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/request_store-1.3.1/lib/request_store/middleware.rb:9:in `call' /home/collegeplus/canvas/app/middleware/request_context_generator.rb:49:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/methodoverride.rb:21:in `call' /home/collegeplus/canvas/app/middleware/prevent_non_multipart_parse.rb:32:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/runtime.rb:17:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-1.5.4/lib/rack/sendfile.rb:112:in `call' /home/collegeplus/canvas/vendor/bundle/ruby/2.2.0/gems/rack-mini-profiler-0.9.2/lib/mini_profiler/profiler.rb:193:in `call' /home/canvas/vendor/bundle/ruby/2.2.0/gems/railties-4.0.13/lib/rails/engine.rb:511:in `call' /home/canvas/vendor/bundle/ruby/2.2.0/gems/railties-4.0.13/lib/rails/application.rb:97:in `call' /home/canvas/vendor/bundle/ruby/2.2.0/gems/railties-4.0.13/lib/rails/railtie/configurable.rb:30:in `method_missing' /usr/local/rvm/gems/ruby-2.2.4@global/gems/passenger-5.0.14/lib/phusion_passenger/rack/thread_handler_extension.rb:94:in `process_request' /usr/local/rvm/gems/ruby-2.2.4@global/gems/passenger-5.0.14/lib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request' /usr/local/rvm/gems/ruby-2.2.4@global/gems/passenger-5.0.14/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' /usr/local/rvm/gems/ruby-2.2.4@global/gems/passenger-5.0.14/lib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads' /usr/local/rvm/gems/ruby-2.2.4@global/gems/passenger-5.0.14/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'

Cody Cutrer

unread,
Apr 14, 2016, 9:08:49 PM4/14/16
to canvas-l...@googlegroups.com
Josh,

It looks like you have a leading blank space in your URI. This should be in the configuration of the LTI tool in this particular Canvas instance.

Cody Cutrer
Software Engineer
Instructure

--

---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josh Kraemer

unread,
Apr 15, 2016, 3:34:35 PM4/15/16
to Canvas LMS Users
Cody,

Thanks for the reply. I tried re-adding the LTI tool multiple times - typing in the URI and ensuring there are no blank spaces anywhere. But I still get the same issue with any LTI tool.

Could it be an extra line somewhere in the source code?

Josh Kraemer

unread,
Apr 15, 2016, 6:02:58 PM4/15/16
to Canvas LMS Users
Cody,

After a little trial and error, I was able to "fix" the issue by changing URI.parse(url) to URI.parse(URI.encode(url.strip)) on the following files:


I still don't know why this would fix the issue even when their are no URLs in the LTI tool that have spaces, special characters, etc.

Cody Cutrer

unread,
Apr 18, 2016, 2:33:26 PM4/18/16
to canvas-l...@googlegroups.com
Josh,

I'm not very familiar with this code, so can't give much insight. The `strip` is innocuous enough, but `URI.encode` is a huge red flag that you're going to break someone else because you're adding an extra level of encoding, and changing the meaning of the URI components.

Cody Cutrer
Software Engineer
Instructure
Reply all
Reply to author
Forward
0 new messages