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

Nodered crash when loading dist/js file #849

Open
pheex opened this issue Jan 10, 2025 · 0 comments
Open

Nodered crash when loading dist/js file #849

pheex opened this issue Jan 10, 2025 · 0 comments

Comments

@pheex
Copy link

pheex commented Jan 10, 2025

What are the steps to reproduce?

not able to reproduce it, so maybe link to network race condition

What happens?

Nodered process crash when serving js file on dashboard loading

8 Jan 15:02:51 - [red] Uncaught Exception: - -
8 Jan 15:02:51 - Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client - -
at ServerResponse.setHeader (_http_outgoing.js:470:11) - -
at ServerResponse.header (/usr/src/node-red/node_modules/express/lib/response.js:771:10) - -
at ServerResponse.contentType (/usr/src/node-red/node_modules/express/lib/response.js:599:15) - -
at ServerResponse.sendStatus (/usr/src/node-red/node_modules/express/lib/response.js:357:8) - -
at /usr/src/node-red/node_modules/node-red-dashboard/nodes/ui_base.js:99:21 - -
at /usr/src/node-red/node_modules/express/lib/response.js:434:22 - -
at onerror (/usr/src/node-red/node_modules/express/lib/response.js:1044:5) - -
at Array.onfinish (/usr/src/node-red/node_modules/express/lib/response.js:1062:21) - -
at listener (/usr/src/node-red/node_modules/on-finished/index.js:169:15) - -
at onFinish (/usr/src/node-red/node_modules/on-finished/index.js:100:5) - -
at callback (/usr/src/node-red/node_modules/ee-first/index.js:55:10) - -
at Socket.onevent (/usr/src/node-red/node_modules/ee-first/index.js:93:5) - -
at Socket.emit (events.js:203:15) - -
at errorOrDestroy (internal/streams/destroy.js:107:12) - -
at onwriteError (_stream_writable.js:430:5) - -
at onwrite (_stream_writable.js:461:5)

What do you expect to happen?

no header sent twice and not nodered crash

Maybe on this block code, the sendStatus is sending again the header, and if previous sendfile has already send the header and got a connection close error, the ERR_HTTP_HEADERS_SENT is triggered
The sendfile can return network error, not only not found file error

RED.httpAdmin.get('/ui_base/js/*', function(req, res) {
res.sendFile(req.params[0], optsjs, function (err) {
if (err) {
res.sendStatus(404);

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

No branches or pull requests

1 participant