Picture of Lars Halkjær
xApi plugin not sending statements
by Lars Halkjær - Thursday, 24 February 2022, 11:08 AM
 

I have made an xApi Adapt test course (AT 0.10.5, FW 5.18.4) to test all the statements that Adapt can send.

It was made using adapt-contrib-xapi ver. 0.8.3 and it worked fine.

I then tried updating adapt-contrib-xapi to the latest ver. 0.9.4 but now I get no statements at all (I am testing it in SCORM Cloud).

Has anyone experienced this?

Picture of Ignacio Cinalli
Re: xApi plugin not sending statements
by Ignacio Cinalli - Friday, 25 February 2022, 5:43 PM
Picture of Oliver Foster
Re: xApi plugin not sending statements
by Oliver Foster - Monday, 28 February 2022, 12:28 PM
 

Would you mind leaving an issue on the github repository please?

Picture of Ignacio Cinalli
Re: xApi plugin not sending statements
by Ignacio Cinalli - Monday, 28 February 2022, 2:54 PM
 

Thank you. Have posted an issue on Github.

Picture of Oliver Foster
Re: xApi plugin not sending statements
by Oliver Foster - Monday, 28 February 2022, 4:24 PM
Picture of Lars Halkjær
Re: xApi plugin not sending statements
by Lars Halkjær - Tuesday, 1 March 2022, 12:19 AM
 

I looked at the bugfix and implemented the code:

if (Object.keys(newConfig).length > 0) {

in this line:
https://github.com/adaptlearning/adapt-contrib-xapi/blob/d6b98eb8e48eecab98d09c89a378af802a2cb367/js/XAPI.js#L1004

And I suddenly got some statements in the LRS (I have tested in SCORM Cloud's sandbox LRS)!

But I noticed that some of the expected statements at the end of the session seemed to be missing (like "terminated").

I noticed an error occurred in this line:
https://github.com/adaptlearning/adapt-contrib-xapi/blob/d6b98eb8e48eecab98d09c89a378af802a2cb367/js/XAPI.js#L1004

I believe it is the same issue as in the above bug fix, but also a problem with the "result" parameter which is optional and could be undefined.

So I tried with this code:

if (result && (Object.keys(result).length > 0)) {

But the last statements are still missing, and I get this error when I close the course:

react_devtools_backend.js:4061 ERROR: adapt-contrib-xapi: DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://cloud.scorm.com/lrs/45MN2ZJO0D/sandbox/statements': Synchronous XHR in page dismissal. See https://www.chromestatus.com/feature/4664843055398912 for more details.
at Object._.XHR_request (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/libraries/xapiwrapper.min.js:3:33505)
at t.sendStatement (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/libraries/xapiwrapper.min.js:3:21672)
at XAPI._callee17$ (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/adapt/js/adapt.min.js:16037:43)
at s (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/libraries/bowser.js:2:105708)
at Generator._invoke (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/libraries/bowser.js:2:105496)
at Generator.forEach.t.<computed> [as next] (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/libraries/bowser.js:2:106131)
at asyncGeneratorStep (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/adapt/js/adapt.min.js:51:26)
at _next (https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/adapt/js/adapt.min.js:73:11)
at https://cloud.scorm.com/sandbox/content/courses/45MN2ZJO0D/xapi-test-course_20220301_05349e0d0a36b-3c84-4027-a220-88af9cec56f8/0/adapt/js/adapt.min.js:80:9
at new Promise (<anonymous>)

And I am not sure what causes this error.

Picture of Oliver Foster
Re: xApi plugin not sending statements
by Oliver Foster - Tuesday, 1 March 2022, 9:07 AM
 

Hi Lars,

It would be helpful if you could reply on github rather than in the forums. The work is much easier to manage there.

Warm regards,

 

Ollie

Picture of Lars Halkjær
Re: xApi plugin not sending statements
by Lars Halkjær - Wednesday, 2 March 2022, 9:34 AM
 

Of course.

I made the smallest test course I could to verify the problem and created a new issue in GitHub describing it.