public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
268 stars 54 forks source link

error with oebb profile #318

Closed CuzImMartin closed 1 month ago

CuzImMartin commented 1 month ago

Hi, I have been working on a project and have already worked with the db hafas client without any problems. now I wanted to query data from the öbb client as well. However, this error occurs when querying departures and arrivals:

Error fetching data from HAFAS: HafasError: ERROR: HCI Core: Error occurs : HCI Core: An ENUM value was used that is not available in the requested version/extension : root.svcResL.svcResL.res.common.rtSrcL.rtSrcL.type.type
    at checkIfResponseIsOk (file:///D:/Development/Projekte/xxx/hafas-api/node_modules/hafas-client/lib/request.js:103:9)
    at Object.request (file:///D:/Development/Projekte/xxx/hafas-api/node_modules/hafas-client/lib/request.js:206:2)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _stationBoard (file:///D:/Development/Projekte/xxx/hafas-api/node_modules/hafas-client/index.js:91:25)
    at async Object.departures (file:///D:/Development/Projekte/xxx/hafas-api/node_modules/hafas-client/index.js:109:10)
    at async file:///D:/Development/Projekte/xxx/hafas-api/server.mjs:66:34 {
  isHafasError: true,
  code: null,
  isCausedByServer: false,
  hafasCode: 'ERROR',
  request: Request {
    size: 0,
    timeout: 0,
    follow: 20,
    compress: true,
    counter: 0,
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype] {},
      freeSockets: [Object: null prototype],
      keepAliveMsecs: 1000,
      keepAlive: true,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 2,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    [Symbol(Body internals)]: {
      body: <Buffer 7b 22 6c 61 6e 67 22 3a 22 64 65 22 2c 22 73 76 63 52 65 71 4c 22 3a 5b 7b 22 6d 65 74 68 22 3a 22 53 74 61 74 69 6f 6e 42 6f 61 72 64 22 2c 22 72 65 ... 315 more bytes>,
      disturbed: false,
      error: null
    },
    [Symbol(Request internals)]: {
      method: 'POST',
      redirect: 'follow',
      headers: [Headers],
      parsedURL: [Url],
      signal: null
    }
  },
  response: Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: { body: [Gunzip], disturbed: true, error: null },
    [Symbol(Response internals)]: {
      url: 'https://fahrplan.oebb.at/bin/mgate.exe?',
      status: 200,
      statusText: 'OK',
      headers: [Headers],
      counter: 0
    }
  },
  url: 'https://fahrplan.oebb.at/bin/mgate.exe?',
  hafasResponseId: 'd446bjkugkaqg4wg',
  hafasMessage: 'HCI Core: Error occurs : HCI Core: An ENUM value was used that is not available in the requested version/extension : root.svcResL.svcResL.res.common.rtSrcL.rtSrcL.type.type'
}
derhuerst commented 1 month ago

Currently, I can't reproduce this problem when fetching departures from 8100013 & 8100173.

Can you provide the request(s) that caused this error, as well as your hafas-client version?

CuzImMartin commented 1 month ago

newest version of hafas-client and the departure request, i've not tryed others yet after i struggled a few hours with it

derhuerst commented 1 month ago

the departure request, i've not tryed others yet

With which stop/station ID?

CuzImMartin commented 1 month ago

Currently, I can't reproduce this problem when fetching departures from 8100013 & 8100173.

Can you provide the request(s) that caused this error, as well as your hafas-client version?

It's not only about this 2 dep. I get the error all the time, i don't know if i'm dump and do something wrong, but for me nothing is working with the departure call.

Maybe you provide a simple example what is working for you?

Maybe simply the code how you get all dep. of Vienna mainstation, that would be great.

derhuerst commented 1 month ago

It's not only about this 2 dep. I get the error all the time, i don't know if i'm dump and do something wrong, but for me nothing is working with the departure call.

Maybe you provide a simple example what is working for you?

./tools/debug-cli/cli.js oebb departures 8100013 | jq
{
    "departures": [
        {
            "tripId": "2|#VN#1#ST#1721035249#PI#0#ZI#193643#TA#2#DA#150724#1S#8103000#1T#1755#LS#8100002#LT#2049#PU#81#RT#1#CA#RJ#ZE#744#ZB#RJ 744  #PC#0#FR#8103000#FT#1755#TO#8100002#TT#2049#",
            "stop": {
                "type": "stop",
                "id": "8100013",
                "name": "Linz/Donau Hbf",
                "location": {
                    "type": "location",
                    "id": "8100013",
                    "latitude": 48.290151,
                    "longitude": 14.291815
                },
                "products": {
                    // …
                }
            },
            "when": "2024-07-15T19:32:00+02:00",
            "plannedWhen": "2024-07-15T19:30:00+02:00",
            "delay": 120,
            "platform": "6A-F",
            "plannedPlatform": "6A-F",
            "prognosisType": "prognosed",
            "direction": "Salzburg Hbf",
            "provenance": null,
            "line": {
                "type": "line",
                "id": "rj-744",
                "fahrtNr": "744",
                "name": "RJ 744",
                "public": true,
                "adminCode": "81____",
                "productName": "RJ",
                "mode": "train",
                "product": "nationalExpress",
                "operator": {
                    "type": "operator",
                    "id": "nahreisezug",
                    "name": "Nahreisezug"
                }
            },
            "remarks": [
                // …
            ],
            "origin": null,
            "destination": {
                "type": "stop",
                "id": "8100002",
                "name": "Salzburg Hbf",
                "location": {
                    "type": "location",
                    "id": "8100002",
                    "latitude": 47.812824,
                    "longitude": 13.045559
                },
                "products": {
                    "nationalExpress": true,
                    "national": true,
                    "interregional": true,
                    "regional": true,
                    "suburban": true,
                    "bus": false,
                    "ferry": false,
                    "subway": false,
                    "tram": false,
                    "onCall": false
                }
            },
            "currentTripPosition": {
                "type": "location",
                "latitude": 48.28651,
                "longitude": 14.28875
            }
        },
        // …
    ],
    "realtimeDataUpdatedAt": 1721064710
}
derhuerst commented 1 month ago

Just like with https://github.com/public-transport/hafas-client/issues/233, this error seems to be not reproducible reliably.

CuzImMartin commented 1 month ago

JS would be great

CuzImMartin commented 1 month ago

the departure request, i've not tryed others yet

With which stop/station ID?

Vienna mainstation with 8103000 and various other in austria, like Linz, Wels and Salzburg

derhuerst commented 1 month ago

Vienna mainstation with 8103000 […]

Still can't reproduce the problem.

CuzImMartin commented 1 month ago

Vienna mainstation with 8103000 […]

Still can't reproduce the problem.

hafas-client with db-profile has the same stationIDs like oebb, right?

derhuerst commented 1 month ago

hafas-client with db-profile has the same stationIDs like oebb, right?

The station IDs are dictated by the HAFAS instance/endpoint. DB and ÖBB run different instances, but they might use the same IDs for some (many?) stations.

CuzImMartin commented 1 month ago

i'm gonna try again in 3 hours, maybe i am lucky and get it work

CuzImMartin commented 1 month ago

i got it to work, thank you very much

derhuerst commented 1 month ago

i got it to work, thank you very much

Please provide details on what you changed and how your determined if it works.

Maybe we can resolve this for everyone who has this problem. And if we can't, we can try to further deduce under which circumstances the problem appears.

CuzImMartin commented 1 month ago

i got it to work, thank you very much

Please provide details on what you changed and how your determined if it works.

Maybe we can resolve this for everyone who has this problem. And if we can't, we can try to further deduce under which circumstances the problem appears.

I used the same logic as for the db-profile, followed the cli and after a bit of trial and error it worked

derhuerst commented 1 month ago

can you provide commands?

derhuerst commented 1 month ago

Closing in favour of #233. Please post (new!) insights about the problem over there.