question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

moodle request on /keys route fails: upgrade required

See original GitHub issue

Describe the bug when using ltijs-demo-server connecting to moodle server, ltijs provider is reachable upon setup, but neither grade nor class users action fails. When either grade is submitted, or roster is requested through demo-server frontend, Moodle fails on seemingly getting to ltijs jwks route, and then fails to parse the KeySet because it’s null. Here are the moodle debug reports:

[php7:warn] [pid 200] [client 127.0.0.1:57740] PHP Warning: file_get_contents(https://ltijs.math.enlearn.org/keys): failed to open stream: HTTP request failed! HTTP/1.1 426 Upgrade Required
 in /bitnami/moodle/mod/lti/locallib.php on line 1365
[Wed Nov 25 18:14:35.225013 2020] [php7:notice] [pid 229] [client 127.0.0.1:37356] Default exception handler: Exception - Argument 1 passed to Firebase\\JWT\\JWK::parseKeySet() must be of the type array, null given, called in [dirroot]/mod/lti/locallib.php on line 1367 Debug: 
Error code: generalexceptionmessage
* line 35 of /lib/php-jwt/src/JWK.php: TypeError thrown
* line 1367 of /mod/lti/locallib.php: call to Firebase\\JWT\\JWK::parseKeySet()
* line 1422 of /mod/lti/locallib.php: call to lti_verify_with_keyset()
* line 71 of /mod/lti/token.php: call to lti_verify_jwt_signature()

ltijs with debug turned on reports:

2020-11-25T18:03:13.189Z provider:platform Valid access_token for https://moodle.math.enlearn.org not found 2020-11-25T18:03:13.190Z provider:platform Attempting to generate new access_token for https://moodle.math. 
2020-11-25T18:03:13.190Z provider:platform With scopes: https://purl.imsglobal.org/spec/lti-nrps/scope/cont 
2020-11-25T18:03:13.322Z provider:auth Awaiting return from the platform HTTPError: Response code 404 (Not Found)   
     at Request.<anonymous> (/app/node_modules/got/dist/source/as-promise/index.js:117:42)     
     at processTicksAndRejections (internal/process/task_queues.js:93:5) {                                   
       code: undefined,

Any idea why this would be? what does /keys route expect the protocol to be upgraded to?

Expected behavior Since platform seems to be correctly registered, and links work, something else is preventing basic reporting features to work.

Ltijs version latest

NodeJS version 14

Platform used Moodle latest

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zoranpopoviccommented, Nov 26, 2020

Thanks for the help. I fixed the issue, but just in case someone else is stuck on something similar, moodle gets the keys with a php call file_get_contents(https://ltijs.example.com/keys), which is some archaic code that makes a http/1.0 call. Since my ltijs instance was running behind istio which by default does not allow this deprecated protocol, it just rejected it before getting to ltijs, asking for upgrade to http/1.1. Strangely, other moodle calls are not via http/1.0 just those with file_get_contents. Making istio accept 1.0 calls fixed the issue.

1reaction
Cvmcostacommented, Nov 26, 2020

If the endpoint is returning the keys correctly then the issue is with the communication between Platform and Tool. Your Platform is not capable of reaching your Tool.

The Keyset endpoint does not require any sort of input or authorization, if it is working correctly from the browser then the only possible issue is an inability to reach the endpoint.

I was not familiar with the HTTP/1.1 426 Upgrade Required error, but after some research i am confident that the issue is most likely not caused by the Ltijs server, but instead by the proxy redirecting requests to the express server Ltijs runs on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error upgrading from 3.8 to 3.10.3 latest release - Moodle.org
I'm attempting to prove the viability of upgrading a copy of our current Moodle site which is running on 3.8 to the latest...
Read more >
Moodle in English: Failed upgrade repair possible?
After I upgraded to the latest V3.3.2. I cannot manage authentication, because of the following error shows up:
Read more >
Cannot upgrade Moodle 3.2.1 to 3.5
So I will report back once I've been through the whole Linux upgrade path and then ... Error: invalidparameter externallib.php and a missing...
Read more >
Moodle Upgrade from 3.5.1 to 3.6.x or 3.7.x
Hi there,. I'm planning to upgrade our moodle site from 3.5.1+ to 3.6.4 or latest 3.7.x. I'm guessing I have to upgrade php...
Read more >
Issues after Softaculous Moodle 4.0 Upgrade from 3.11.6
When Softaculous attempts to upgrade Moodle it leaves the previous ... H5P resource modules for the "same thing", require launching a "migrate" script....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found