xAPI Statements Not Sent to External LRS (TraxLRS)

Created on 18 June 2025, 26 days ago

Problem/Motivation

xAPI statements are not sent to the external LRS (TraxLRS) after completing LMS activities.

TraxLRS works fine when called directly:

curl -X POST http://lrs.example.com/trax/api/gateway/clients/default/stores/default/xapi \
  -H "Authorization: Basic [base64-credentials]" \
  -H "X-Experience-API-Version: 1.0.3" \
  -H "Content-Type: application/json" \
  -d '{...}'

But no LMS activity (e.g., H5P completions) results in data reaching TraxLRS.

Expected
xAPI statements generated by LMS should be sent to the configured LRS

Steps to reproduce

  1. Configure external LRS (traxLRS), Agent: Mbox =mailto: site-user-email, Everywhere
  2. Obtain TraxLRS access details (Endpoint url, Username, Password)
  3. Go to /admin/lms/settings/xapi and add the access details from external LRS.
  4. Complete LMS activities
  5. Check /trax/starter/statements for results

No Result
The Endpoint URL in TraxLRS is /trax/api/gateway/clients/default/stores/default/xapi
not sure if LMS xAPI is expecting a different pattern

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States GarChris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @GarChris
  • πŸ‡ΊπŸ‡ΈUnited States GarChris

    I tried to use the LMS internal LRS but wasn't able to get it working. The configuration screen outputs:

    LRS endpoint: http://example.com//lrs/endpoint (Note the double slashes).

    And credentials fields:

    LRS API user name:

    LRS API password:

    But I have no idea what credentials are to be entered into these fields (is this for entering new credentials that would be used in LMS xAPI to connect to this LRS (I tried that with no results). Visiting /lrs/endpoint even without the double slashes gives 404 page not found.

  • πŸ‡¬πŸ‡§United Kingdom catch

    (is this for entering new credentials that would be used in LMS xAPI to connect to this LRS

    Yes.

    But no LMS activity (e.g., H5P completions) results in data reaching TraxLRS.

    Can you check both the browser console and dblog for any error messages?

    Also have you only tried the lms_h5p activity plugin or also the lms_xapi activity plugin?

  • πŸ‡ΊπŸ‡ΈUnited States GarChris

    There is this error in the logs
    TypeError: Drupal\lms\Controller\CourseController::activity(): Argument #3 ($activity_delta) must be of type int, string given in Drupal\lms\Controller\CourseController->activity() (line 81 of ../web/modules/contrib/lms/src/Controller/CourseController.php).

    I tried the lms_xapi activity but I honestly don't understand how that works. The only option available is to upload an xapi package, but how to create that package?

    My main reason for using the h5p activity type is for the Fill in the Blanks, which LMS doesn't seem to supply. Except that lms_h5p activities are not being tracked properly ( https://www.drupal.org/project/lms_h5p/issues/3530848 πŸ› LMS H5P Course Activities Not Being Correctly Evaluated Active )

  • πŸ‡¨πŸ‡¦Canada ob3ron Canada

    @garchris can you create a feature request for a Fill in the Blanks plugin in the Drupal LMS issue queue β†’ ? I'm also interested in that being included.

  • πŸ‡ΊπŸ‡ΈUnited States GarChris

    I created a feature request for a Fill in the Blanks plugin - https://www.drupal.org/project/lms/issues/3531918 ✨ Drupal LMS Fill in the Blanks Active

  • πŸ‡ΊπŸ‡ΈUnited States GarChris

    I just confirmed that the error in comment #4 πŸ’¬ xAPI Statements Not Sent to External LRS (TraxLRS) Active only occurs when an H5P Activity is loaded, so that may not be related to this issue (statements not being sent to the external LRS). No statements are sent either on completion of non-h5p activities (when there is no error).

    I'd appreciate some insight on the double slashes in the internal LRS endpoint displayed on the settings page: (http://example.com//lrs/endpoint - Note the double slashes)." That clearly is not the correct url so what should it be and how do you configure it. http://example.com/lrs/endpoint (with or without the double slashes) shows 404 not found).

  • πŸ‡¬πŸ‡§United Kingdom catch

    @garchris in the logs you posted, I see page_all.js:

    Here is what's in the console. 
    init command html
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command clearCart
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command getOrdersListProduct
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command getTrackDetals
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command getOrderDetail
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command getReview
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command clearAddres
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 init command countAddress
    page_all.js:2 init command http://example.com/course/1/0/1
    page_all.js:2 add class expansion-alids-init
    jquery.js:1 
    

    Have you tried to reproduce this with a clean LMS install? This really needs steps to reproduce with a clean install.

    I'd appreciate some insight on the double slashes in the internal LRS endpoint

    I think that's bug in the form descriptions, but it shouldn't result in any functional bug - the internal LRS should be pointed to with only single slashes.

  • πŸ‡ΊπŸ‡ΈUnited States GarChris

    The Internal LRS works properly without the double slashes. I thought I'd tried that but guess I'd missed something. With this working, I have no need for an external LRS. I apologies for the confusion.

Production build 0.71.5 2024