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.

Cannot read property 'lineitem' of null error when using lti.Grade.getLineItems(idtoken, { resourceLinkId: true })

See original GitHub issue

Hi 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: image Here are the logs: image 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: image

Thanks for your help in advance Carlos!

Issue Analytics

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

github_iconTop GitHub Comments

Cvmcostacommented, Apr 15, 2021

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.

Cvmcostacommented, Apr 14, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

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 Post

No results found

github_iconTop Related Hashnode Post

No results found