Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: use Node 16, remove HTTP/2 support #1346

Merged
merged 3 commits into from
Nov 13, 2021
Merged

feature: use Node 16, remove HTTP/2 support #1346

merged 3 commits into from
Nov 13, 2021

Conversation

tkurki
Copy link
Member

@tkurki tkurki commented Sep 25, 2021

  • run tests with 16 (and legacy 10)
  • specify >10 in package.json
  • specify 16 in nvmrc

See also #1133

- run tests with 16 (and legacy 10)
- specify >10 in package.json
- specify 16 in nvmrc
@MatsA
Copy link
Contributor

MatsA commented Nov 3, 2021

Thought it was time to update the RPi install instructions and found this PR. So please find some responses after testing with Node.js V16

Been running SK with Node V14 for a while without problem. Since its recomended to use V16 I updated with
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
and after that updating the SK install

sudo npm install -g --unsafe-perm signalk-server
pi@raspberrypi:~ $ sudo npm install -g --unsafe-perm signalk-server
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN EBADENGINE required: { node: '10' },
npm WARN EBADENGINE current: { node: 'v16.13.0', npm: '8.1.0' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

and then executing

signalk-server --sample-nmea0183-data
Settings file does not exist, using empty settings
Using sample data from /usr/lib/node_modules/signalk-server/samples/plaka.log
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/blog/projects/avahi-compat.html
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/blog/projects/avahi-compat.html
(node:2330) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use node --trace-deprecation ... to show where the warning was created)
signalk-server running at 0.0.0.0:3000

I have done testing with some of the apps and everything went OK, even the @signalk/charts-plugin just worked.
But maybe some fixes is needed to handle the above warnings ?

@tkurki
Copy link
Member Author

tkurki commented Nov 4, 2021

Thanks for testing. Errors related to Node version are

  • Unsupported engine => fixed by this PR, once merged and published
  • DeprecationWarning => I'll see about this

The others are unrelated to Node version upgrade.

@tkurki
Copy link
Member Author

tkurki commented Nov 4, 2021

Trace

(node:34893) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
    at process.binding (node:internal/bootstrap/loaders:133:17)
    at Object.<anonymous> (/Users/teppokurki/git-workspace/signalk/server/node_modules/http-deceiver/lib/deceiver.js:22:24)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/Users/teppokurki/git-workspace/signalk/server/node_modules/spdy/lib/spdy/handle.js:5:20)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)

@tkurki
Copy link
Member Author

tkurki commented Nov 4, 2021

spdy that is used for HTTP/2 support appears to have problems with Node >= 15 spdy-http2/node-spdy#380

I don't think HTTP/2 support is needed in SK server, so I'll see about removing it or making it an optional dependency.

@tkurki tkurki changed the title chore: use Node 16 feature: use Node 16, remove HTTP/2 support Nov 4, 2021
@tkurki
Copy link
Member Author

tkurki commented Nov 4, 2021

If you want to try the version in this branch pull it from Github and

  • npm install && npm run build
  • bin/nmea-from-file

to install

  • npm pack
  • npm install -g signalk-server-1.40.0.tgz

@KEGustafsson
Copy link
Contributor

Been also running Node16 for sometime in one dev machine and no issues with SK server.

Server-admin-ui and server-admin-ui-dependencies seems to require some dependency updates due to Node16 to get my own ui modifications running with new node version.

@MatsA
Copy link
Contributor

MatsA commented Nov 5, 2021

Tried to test ...

pi@raspberrypi:~/signalk-server-node $ npm install
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

pi@raspberrypi:~/signalk-server-node $ npm run build

[email protected] build
tsc

pi@raspberrypi:~/signalk-server-node $ bin/nmea-from-file
/usr/bin/env: ‘node --trace-deprecation’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

a little over my knowledge.... ;-)

The spdy module appears to be incompatible with Node >=15
as of this writing

spdy-http2/node-spdy#380

As HTTP/2 is relevant only for SSL connections and I
think that is pretty rarely used I think a pretty safe
and convenient option is to remove HTTP/2 support
and spdy module.
@tkurki
Copy link
Member Author

tkurki commented Nov 5, 2021

@MatsA thanks, I had accidentally committed --trace-deprecation, fixed now in Github version.

@MatsA
Copy link
Contributor

MatsA commented Nov 5, 2021

OK, new version tested and works very well, no errors in the server log. The warnings are almost the same in the installation

npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

Tested with, Freeboard, charts plugin, and AIS input as UDP data. If you think its needed I can test serial, Acticense, input in the boat ?

NodeRed tested and OK, but a very old version 1.3.7, latest version 2.1.3....

Any other thoughts ?

/Mats

@tkurki
Copy link
Member Author

tkurki commented Nov 6, 2021

@KEGustafsson please share what changes you needed to do in those packages.

@tkurki
Copy link
Member Author

tkurki commented Nov 6, 2021

@MatsA since serial connections need native binary modules those are more risky in terms of compatibility, so that's what I'd test next.

The old versions were not supported on Node 16 and my M1 mac,
not sure if this is really Node 16 related but these will
probably need updating anyway sooner or later.
@KEGustafsson
Copy link
Contributor

KEGustafsson commented Nov 6, 2021

@KEGustafsson please share what changes you needed to do in those packages.

@tkurki These were the modification that I made.

server-admin-ui-dependencies
server-admin-ui-dependencies.patch.txt
and then npm pack and used that locally in server-admin-ui as a dependency.

server-admin-ui
server-admin-ui.patch.txt

Edit:
sass-loader seems to be in v12, but I have still in v11 due to earlier SK trials with node16 on spring time. Same with the node-sass.

@MatsA
Copy link
Contributor

MatsA commented Nov 6, 2021

@tkurki OK, tested with Actisense NGT-1 and no problem.

But missed a problem with NodeRed, from server log
(node:5825) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/pi/signalk-server-node/node_modules/@node-red/editor-client/package.json' of './lib/index.js'. Please either fix that or report it to the module author
(Use node --trace-deprecation ... to show where the warning was created)
signalk-server running at 0.0.0.0:3000

Did an upgrade
pi@raspberrypi:~/signalk-server-node/node_modules/@signalk/signalk-node-red $ npm install node-red@latest
and it solved the problem !

Additional apps tested

@signalk/charts-plugin
@signalk/signalk-node-red
@signalk/vedirect-serial-usb
signalk-ruuvitag-plugin
signalk-shelly

and some UDP sources and no problem.

Think that the Avahi warnings could be a bit annoying for newbies ? The project https://github.com/homebridge/homebridge had the same problem for a year ago. Maybe could get a hint from their code ?

@tkurki
Copy link
Member Author

tkurki commented Nov 8, 2021

Agreed, Avahi warnings are a nuisance. Looked into Homebridge and added #1353 to cover that issue.

@tkurki
Copy link
Member Author

tkurki commented Nov 8, 2021

@KEGustafsson thanks. Do you remember what kind of trouble you had with Redux? Just wondering if the issue may have been resolved in an updated Redux and no longer needs action.

@KEGustafsson
Copy link
Contributor

@KEGustafsson thanks. Do you remember what kind of trouble you had with Redux? Just wondering if the issue may have been resolved in an updated Redux and no longer needs action.

No specifix problem with Redux but npm install caused errors during build and these modifications removed issues.

@tkurki
Copy link
Member Author

tkurki commented Nov 10, 2021

@MatsA
Copy link
Contributor

MatsA commented Nov 12, 2021

OK. Since the boat is on the hard, the engines are winterized and I'm just waiting for to ski in the Alps during Christmas.... ;-)
... I did some more testing using Bullseye, with this branch and Node 16.

It works very well !!

pi@raspberrypi:~/signalk-server-node $ npm install
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

Even the Avahi warnings disappeared ??

pi@raspberrypi:~/signalk-server-node $ bin/nmea-from-file
signalk-server running at 0.0.0.0:3000

Tomorrow, probably, I will check the serial interface in the boat with Actisense and some more plugins.
Is there anything else I can help with before this branch goes in production ?

@MatsA
Copy link
Contributor

MatsA commented Nov 13, 2021

Don't know if it matters but installing the NodeRed plugin on Buster gave the path
pi@raspberrypi:/home/pi/signalk-server-node/node_modules/@signalk/signalk-node-red
On Bullseye it gave
/home/pi/.signalk/node_modules/@signalk/signalk-node-red
?

@tkurki
Copy link
Member Author

tkurki commented Nov 13, 2021

I think we should separate node 16 from Bullseye related details. If there's something odd going on please add an issue for it.

@tkurki tkurki merged commit 2c4bdae into master Nov 13, 2021
@tkurki tkurki deleted the node-16-build branch November 13, 2021 14:48
@MatsA
Copy link
Contributor

MatsA commented Nov 13, 2021

Yes, one thing at a time.
But maybe skip the planned Avahi update since it seems to be solved with Bullseye ?
Thanks for the merge, will update the RPi installation with Node V16, when this PR is included in next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants