adlnet/lrs-conformance-test-suite

Doubt regarding error: TypeError: X-Experience-API-Consistent-Through header was missing or not a number

hxs133530 opened this issue · 1 comments

Hi,
I am implementing a xAPI LRS and when I run the conformance test, I am getting two failures with error 'TypeError: X-Experience-API-Consistent-Through header was missing or not a number.' I am unable to understand why the error is happening even though for both the POST and the GET requests, the 'X-Experience-API-Consistent-Through' header exists. I have attached screenshots of the log. I would really appreciate any help in solving this error. All the other tests are passing.
error1_21 0
error2_29 2 0

Hi @hxs133530,

I had the same issue and the reason was a duplicate Date header in the LRS responses:

Capture

This may occur in certain circumstances and the LRS Conformance Test Suite does not like it.

In file test/helper.js, line 271, the property res.headers.date returns Thu, 22 Dec 2022 09:58:28 GMT, Thu, 22 Dec 2022 09:58:28 GMT, which is an invalid date.

My workaround: if you can't solve the issue on the server side, replace res.headers.date by res.headersDistinct.date[0]. You need NodeJS v18.3.0+, v16.17.0+ (https://nodejs.org/api/http.html#messageheadersdistinct).