Cannot read property 'lineitem' of null error when using lti.Grade.getLineItems(idtoken, { resourceLinkId: true })
See original GitHub issueHi Carlos, sorry for bringing up another issue again so soon but I am having some difficulties with the “Grading route” (and also the “Names and Roles” route but that can be for another time) in routes.js
of the ltijs-demo-server.
routes.js
:
Here are the logs:
From the logs, I can see that the “endpoint” value is null. Am I missing something here?
I then tweaked the code to bypass the null value by adding the line let lineItemId = (idtoken.platformContext.endpoint) ? idtoken.platformContext.endpoint.lineitem : null
but then hit an error at the lti.Grade.getLineItems(idtoken, { resourceLinkId: true })
line:
Thanks for your help in advance Carlos!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
LTI 1.3 resource_link id from module launch cannot be set on ...
Launch the tool from module and note down the resource_link claim's id value from the id token; Attempt to create a lineitem with...
Read more >How to fix 'Cannot read property 'id' of 'null' - Stack Overflow
If the error message says "Could not read property 'id' of null" it means that the guild property exists, but it is null...
Read more >Launching an LTI 1.3 Resource Link using OpenID Connect ...
The tool verifies that the platform issuer is valid and sends an Authorization Request back to the platform requesting an id_token be POSTed...
Read more >ltijs - bytemeta
Cannot read property 'lineitem' of null error when using lti.Grade.getLineItems(idtoken, { resourceLinkId: true }). vandergav. vandergav CLOSED.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, i know what this is. This issue is happening because you switched the LTI_KEY after registering Platforms. Basically the Platform is trying to get the Keyset (Collection of every Public Key for every Platform registered), and LTIJS is unable to decrypt some of them due to the LTI_KEY used to encrypt not being the same one being used to decrypt.
This is a hard to fix issue unless you know the client ID of every Platform you registered with the old keys. My suggestion would actually be to delete the platforms, publickey and privatekey tables from the Database manually and then create a new one. Alternatively you could just use a new database and it would have the same affect.
Hello! This is a permissions issue. You need to enable the Grades and Names and Roles service when registering the Tool on Moodle. If you don’t give the tool the correct access, the ID Token will not contain the endpoint field.