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.

Error retrieving NameAndRoles

See original GitHub issue

Describe the bug I’m trying to retrieve data in class NamesAndRoles - function getMembers and get the error HTTPError: Response code 500 (Internal Server Error)

I have logged the data platform from this line

// NameAndRoles.js
async getMembers(idtoken, options) {
...
const platform = await (0, _classPrivateFieldGet2.default)(this, _getPlatform).call(this, idtoken.iss, idtoken.clientId, (0, _classPrivateFieldGet2.default)(this, _ENCRYPTIONKEY), (0, _classPrivateFieldGet2.default)(this, _Database));

console.log({ platform }); // { platform: Platform: {} }
...
}

const options = { limit: 1 };
const idtoken = {
    iss: 'https://canvas.instructure.com',
    user: 'a684e22b-9978-4cef-98d8-98ee5f4cfd6c',
    platformInfo: {
        guid: 'OJwJhR6cNZVC9aiyUh8DLT9onnyVif2hOWpa5490:canvas-lms',
        name: 'Root account',
        version: 'cloud',
        product_family_code: 'canvas',
        validation_context: null
    },
    clientId: '10000000000004',
    platformId: '8421b0dc94540ac04bdf13cc5f7f4460',
    deploymentId: '24:e7484a3d7fa6e228f44fc0fd50c318add6f918bf',
    createdAt: '2020-11-13T03:43:04.941Z',
    platformContext: {
        roles: [Array],
        contextId: 'https%3A%2F%2Fcanvas.instructure.com1000000000000424%3Ae7484a3d7fa6e228f44fc0fd50c318add6f918bfe7484a3d7fa6e228f44fc0fd50c318add6f918bf_e7484a3d7fa6e228f44fc0fd50c318add6f918bf',
        path: '/',
        user: 'a684e22b-9978-4cef-98d8-98ee5f4cfd6c',
        targetLinkUri: 'https://localhost:3003',
        context: [Object],
        resource: [Object],
        launchPresentation: [Object],
        messageType: 'LtiResourceLinkRequest',
        version: '1.3.0',
        endpoint: [Object],
        namesRoles: [Object],
        createdAt: '2020-11-13T03:43:04.957Z'
    }
}

NameAndRolesConsumer

// NameAndRolesConsumer.js
async function caller() {
    const token = res.locals.token;
    const result = await lti.NamesAndRoles.getMembers(token, { limit: 1 });
}

Expected behavior The expected response will be look like the provided response in the documentation in namesandroles

{
  "id" : "https://lms.example.com/sections/2923/memberships",
  "context": {
    "id": "2923-abc",
    "label": "CPS 435",
    "title": "CPS 435 Learning Analytics",
  },
  "members" : [
    {
      "status" : "Active",
      "name": "Jane Q. Public",
      "picture" : "https://platform.example.edu/jane.jpg",
      "given_name" : "Jane",
      "family_name" : "Doe",
      "middle_name" : "Marie",
      "email": "jane@platform.example.edu",
      "user_id" : "0ae836b9-7fc9-4060-006f-27b2066ac545",
      "lis_person_sourcedid": "59254-6782-12ab",
      "roles": [
        "http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor"
      ]
    }
  ]
}

Provider logs Copy of the relevant provider logs.

  1. Run code with debug flag: DEBUG=provider:* npm start.
  2. Copy logs relevant to the issue.
2020-11-13T11:32:26.163Z provider:namesAndRolesService HTTPError: Response code 500 (Internal Server Error)
at Request.<anonymous> (/app/node_modules/got/dist/source/as-promise/index.js:117:42)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Screenshots If applicable, add screenshots to help explain your problem.

Ltijs version

  • Version 1.3 (maybe…) i got this information form package.json file

NodeJS version

  • Version 12.19.0 - containerized in Docker with image node:12.19.0-alpine

Platform used

  • Canvas

Additional context LTI configuration function

// Setup function
const setup = async () => {
    await lti.deploy({ port: vars.PORT }); // vars.PORT = 3000

    const ltiPlatConfig = {
        url: 'https://canvas.instructure.com',
        name: 'dvseok',
        clientId: '10000000000004',
        authenticationEndpoint: 'http://dvseok.shop/api/lti/authorize_redirect',
        accesstokenEndpoint: 'http://dvseok.shop/login/oauth2/token',
        authConfig: {
            method: 'JWK_SET',
            key: 'http://dvseok.shop/api/lti/security/jwks',
        },
    };

    const platform = await lti.registerPlatform(ltiPlatConfig);
    console.log(platform); // { Platform: {}}
};

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nmtoan251998commented, Nov 13, 2020
// package.json
{
  "name": "ltijs-demo",
  "version": "1.0.0",
  "description": "Ltijs demo server",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "env DEBUG=provider:* node index.js"
  },
  "keywords": [
    "lti",
    "ims",
    "ltijs",
    "1.3",
    "imslti"
  ],
  "author": "cvmcosta",
  "license": "MIT",
  "dependencies": {
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "ltijs": "^5.3.3",
    "ltijs-sequelize": "^2.2.0"
  }
}
0reactions
GTMtremolocommented, Dec 29, 2020

@Cvmcosta Thank you, it work

Read more comments on GitHub >

github_iconTop Results From Across the Web

saml2aws/aws_account.go at master - GitHub
CLI tool which enables you to login and retrieve AWS temporary credentials using a SAML IDP ... Wrap(err, "error retrieving AWS login form")....
Read more >
Keep getting permissions error gcloud.container.clusters.get ...
This is an old thread, this is how this issue handled today in case using cloud build : Granting Cloud Build access to...
Read more >
ArcGIS Server Object Extension (SOE) from 10.3.1 to 10.6.1.
I am getting an error here. private THandlerInterface FindRequestHandlerDelegate<THandlerInterface>() where THandlerInterface : class
Read more >
3 Resolved Issues
Result: The user is able to change status without getting an error message, though the user ... Issue: SEARCH RESULT DISPLAYING TEAM NAME...
Read more >
Nothing Found Sorry, the post you are looking for is not ...
Hi, I am getting the below error once migrated website one host o another host ... and also ,verified wp-config.php database name, user...
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