nasa / openmct-tutorial

A tutorial for OpenMCT that guides you through integrating historical and realtime telemetry.
Other
244 stars 106 forks source link

Server crashes when trying to display any telemetry source from "Example Spacecraft" #51

Open jannismain opened 2 years ago

jannismain commented 2 years ago

Whenever I try to click on any telemetry source for the Example Spacecraft, the server crashes with the following output:

$ npm start

> openmct-tutorials@0.0.1 start /Users/mkj/Developer/fobp-openmct/ext/openmct-tutorial
> node example-server/server.js

Example spacecraft launched!
Press Enter to toggle thruster state.
Open MCT hosted at http://localhost:8080
History hosted at http://localhost:8080/history
Realtime hosted at ws://localhost:8080/realtime
events.js:291
      throw er; // Unhandled 'error' event
      ^

RangeError: Invalid WebSocket frame: RSV1 must be clear
    at Receiver.getInfo (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/receiver.js:167:14)
    at Receiver.startLoop (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/receiver.js:121:22)
    at Receiver._write (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/receiver.js:69:10)
    at doWrite (_stream_writable.js:403:12)
    at writeOrBuffer (_stream_writable.js:387:5)
    at Receiver.Writable.write (_stream_writable.js:318:11)
    at Socket.socketOnData (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/websocket.js:795:35)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
Emitted 'error' event on WebSocket instance at:
    at Receiver.receiverOnError (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/websocket.js:700:13)
    at Receiver.emit (events.js:314:20)
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at onwriteError (_stream_writable.js:418:5)
    at onwrite (_stream_writable.js:445:5)
    at Receiver.startLoop (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/receiver.js:141:5)
    at Receiver._write (./openmct-tutorial/node_modules/express-ws/node_modules/ws/lib/receiver.js:69:10)
    [... lines matching original stack trace ...]
    at Receiver.Writable.write (_stream_writable.js:318:11) {
  [Symbol(status-code)]: 1002
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! openmct-tutorials@0.0.1 start: `node example-server/server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the openmct-tutorials@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     ./.npm/_logs/2021-10-20T17_07_17_454Z-debug.log

2021-10-20 7 20 43 PM

The issue seems related to the express-ws module. Anything I could have done differently to cause this? I know that the tutorial used to work for me in the past...

I have already tried the following

I have attached my package-lock.json in case it is related to some rogue dependency that might need to be pinned (zipped because GitHub won't allow uploading json files).

package-lock.json.zip

/edit: updated package-lock.json file

akhenry commented 2 years ago

Thanks for reporting, and for the package-lock! That will help a lot.

This is new behavior, and it's not anything you've done.

Could you tell us which version of Chrome you're using?

akhenry commented 2 years ago

@jannismain I am noticing that express-ws does not appear in your package-lock.json. My package-lock.json shows express-ws version 4.0.0. Not quite sure what this means yet, but is it possible you have express-ws installed globally? Or did you remove the express-ws dependency from your package.json before you ran npm install?

jannismain commented 2 years ago

I have tried it with the following Browsers:

The browser console at time of the crash shows the following:

XHR GEThttp://localhost:8080/history/prop.fuel?start=1634803885565&end=1634804785565
Uncaught TypeError: req.getResponseHeader(...) is null
    generateResponse http://localhost:8080/lib/http.js:21
    onreadystatechange http://localhost:8080/lib/http.js:36
    promise http://localhost:8080/lib/http.js:33
    xhr http://localhost:8080/lib/http.js:28
    get http://localhost:8080/lib/http.js:50
    request http://localhost:8080/historical-telemetry-plugin.js:17
    request http://localhost:8080/node_modules/openmct/dist/openmct.js:335
    fetch http://localhost:8080/node_modules/openmct/dist/openmct.js:346
    load http://localhost:8080/node_modules/openmct/dist/openmct.js:346
    loadSeriesData http://localhost:8080/node_modules/openmct/dist/openmct.js:346
    n http://localhost:8080/node_modules/openmct/dist/openmct.js:17
    handleWindowResize http://localhost:8080/node_modules/openmct/dist/openmct.js:346
    n http://localhost:8080/node_modules/openmct/dist/openmct.js:17
    p http://localhost:8080/node_modules/openmct/dist/openmct.js:11
    y http://localhost:8080/node_modules/openmct/dist/openmct.js:11
    g http://localhost:8080/node_modules/openmct/dist/openmct.js:11
http.js:21:13
jannismain commented 2 years ago

Regarding the package-lock.json I might have given you the wrong one (from openmct instead of openmct-tutorial). Sorry about that.

Here is the correct one: package-lock.json.zip