cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

Error 422 on LTI Advantage grade passback

I have an IMS LTI Advantage certified app (ChemVantage) that I'm trying to configure to submit scores to Canvas using the Assignment and Grade Services v2.0. I keep getting an HttpResponseStatus 422 (Unprocessable Entity) and could use a little help, please.

Details:

Created the assignment in Canvas using DeepLinking workflow OK.

Test student LtiResourceRequest launch OK. Includes resourceLinkId, lineitem URL and scores scope.

When ChemVantage is ready to submit the score to Canvas it requests and receives a valid auth token

Then ChemVantage tries to POST the test student's score:

POST https://salisbury.instructure.com/api/lti/courses/38462/line_items/12/scores
Content-Type: application/vnd.ims.lis.v1.score+json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NhbnZhcy5pbnN0cnVjdHVyZS5jb20iLCJzdWIiOiIzMjU3MDAwMDAwMDAwMDA0NCIsImF1ZCI6Imh0dHBzOi8vY2FudmFzLmluc3RydWN0dXJlLmNvbS9sb2dpbi9vYXV0aDIvdG9rZW4iLCJpYXQiOjE1OTA5MzAwNTgsImV4cCI6MTU5MDkzMzY1OCwianRpIjoiNmE5OTAyOTctMDBmZC00YWZlLWE3ZTMtYTc2ODhiM2E3MDNkIiwic2NvcGVzIjoiaHR0cHM6Ly9wdXJsLmltc2dsb2JhbC5vcmcvc3BlYy9sdGktYWdzL3Njb3BlL3Njb3JlIn0.Z1IY1Uo6eq8rip7ZadKAfsg05jedB4u_sUQKfBeTsSc


{"timestamp":"2020-05-31T13:00:58.255Z","scoreGiven":10,"scoreMaximum":10,"comment":"Number of attempts=11","activityProgress":"Completed","gradingProgress":"FullyGraded","userId":"a1c7f3ad-0648-4009-a03e-0a08e2ba6bca"}


But after writing the JSON to the output stream, the connection status is
Status: 422 Unprocessable Entity
Transfer-Encoding: chunked
null: HTTP/1.1 422 Unprocessable Entity
X-Request-Processor: 00f51242fa5667c8f
X-Request-Context-Id: b28ab049-4ecc-48a7-beed-daed65933f93
Server: Apache
X-Content-Type-Options: nosniff
X-Runtime: 0.120072
X-Request-Cost: 0.11429672700046467
Connection: keep-alive
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
P3P: CP="None, see http://www.instructure.com/privacy-policy"
Date: Sun, 31 May 2020 13:00:58 GMT
Cache-Control: no-cache
X-Rate-Limit-Remaining: 700.0
X-Canvas-Meta: q=701;a=1;g=MnuNKqUKrVdWDEHodbsGkQUJD1owW09oVDb0fI3V;s=3257;c=cluster26;z=us-east-1c;b=2653152;m=2653152;u=0.10;y=0.00;d=0.01;
Vary: Accept-Encoding
X-XSS-Protection: 1; mode=block
X-A11y-Ally: Dana Danger Grey
Content-Type: application/json; charset=utf-8

Canvas didn't seem to like the Content-Type, although this is required by the LTI AGS specifications. I tried sending the POST with Content-type application/json but I got the same result.

If anyone has an idea of how I can take the next step, please let me know!

    

Not Logged in

4 Replies
Highlighted
Community Member

Update: I corrected one problem with the JWT that is submitted to get the oauth2 token (needed to have the correct aud value). However, I am still getting a 422 response code. To simplify, I used curl to submit the request:

curl -X POST -H "Content-Type: application/vnd.ims.lis.v1.score+json" \

-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NhbnZhcy5pbnN0cnVjdHVyZS5jb20iLCJzdWIiOiIzMjU3MDAwMDAwMDAwMDA0NCIsImF1ZCI6Imh0dHBzOi8vc2FsaXNidXJ5Lmluc3RydWN0dXJlLmNvbS9sb2dpbi9vYXV0aDIvdG9rZW4iLCJpYXQiOjE1OTE2MTUxNTUsImV4cCI6MTU5MTYxODc1NSwianRpIjoiY2M5ZGYzNjktNDk1Ny00MjI3LWI0MmQtMjQxMTFhNGYyMDAyIiwic2NvcGVzIjoiaHR0cHM6Ly9wdXJsLmltc2dsb2JhbC5vcmcvc3BlYy9sdGktYWdzL3Njb3BlL3Njb3JlIn0.2-AZX8Z28XnRjqStS0bHApIHcURv1TAoP1JdIUaMZGI" \

-d '{"timestamp":"2020-06-07T18:54:41.697+00:00","scoreGiven":10,"scoreMaximum":10,"comment":"Number of attempts: 21","activityProgress":"Completed","gradingProgress":"FullyGraded","userId":"a1c7f3ad-0648-4009-a03e-0a08e2ba6bca"}' \

https://salisbury.instructure.com/api/lti/courses/38462/line_items/12/scores

The Canvas server response is:

{"errors":{"type":"unprocessable_entity","message":"User not found in course or is not a student"}}

I know the value of the userId is correct, because I can query the Names and Roles Service from my app:

There are 2 members of this group.

User IDRoleNameEmailLMS ScoreCV Score
43ce3f20-ab88-4747-a51e-5356b39e4f50Instructor--
a1c7f3ad-0648-4009-a03e-0a08e2ba6bcaLearner-

30.0%

The Canvas course is published, and the Authorization header JWT contains the correct scope:

{
"iss": "https://canvas.instructure.com",
"sub": "32570000000000044",
"aud": "https://salisbury.instructure.com/login/oauth2/token",
"iat": 1591615155,
"exp": 1591618755,
"jti": "cc9df369-4957-4227-b42d-24111a4f2002",
"scopes": "https://purl.imsglobal.org/spec/lti-ags/scope/score"
}

What am I missing???

0 Kudos
Highlighted
Community Member

Second Update (June 9,2020)

I think I've found the problem. For LTI Advantage Assignment and Grade Services, Canvas does not recognize the Canvas Test Student as having a Learner role, and therefore will not post a score to the grade book. This behavior different from LTI v1.1 connections, which do allow posting of scores to the grade book for Test Student. Canvas has never allowed posting scores for Instructors, although some other LMS platforms do.

It would be helpful if someone from Instructure would verify this, or better yet, change it.

Posting scores for Test Student is one important test for instructors who are setting up a course containing LTI apps. Right now there does not appear to be a way to perform this test until real students are enrolled and completing assignments in the course.

Highlighted
Community Member

I'm having the same issue with the Scores service. Could someone please verify that the problem really is the Test Student.

The documentation on this is not very helpful and it seems to be incorrect. Have a look at Score - Canvas LMS REST API Documentation.

For the userId property it states: 

The lti_user_id or the Canvas user_id. Returns a 412 if user not found in Canvas or is not a student.

 

This is clearly not the case, since it actually returns a 422 code, like you said. A 412 would be an invalid response in this case, so it would be good if Instructure could update the documentation.

0 Kudos
Highlighted
Community Member

I'm also getting a 422 response code when calling the scores service.  

{
   "errors": {
   "type": "unprocessable_entity",
      "message": "User not found in course or is not a student"
   }
}

I have a slightly different workflow that I thought was compatible with lti advantage, but I'm beginning to doubt it since Canvas isn't working. I want a teacher/admin/instructor to sync the grades for an entire class from our tool to Canvas. We're able to get the students user_id from the names and roles service, and use that to send the score for each student. I have it working in Moodle, but Canvas isn't playing ball.

Does anyone know if it's a bug in Canvas, or is my entire approach misguided ?

0 Kudos
Labels