Fix for node-crashing "undefined (reading 'streaming')" error (#4104)

* check for undefined variables in buildChatflow to avoid node crashing exceptions

* Add null check on error Middleware as well
This commit is contained in:
Rafael Reis
2025-02-28 22:20:48 +00:00
committed by GitHub
parent da04289ecf
commit fc9740af16
2 changed files with 18 additions and 6 deletions
@@ -12,7 +12,7 @@ async function errorHandlerMiddleware(err: InternalFlowiseError, req: Request, r
// Provide error stack trace only in development
stack: process.env.NODE_ENV === 'development' ? err.stack : {}
}
if (!req.body.streaming || req.body.streaming === 'false') {
if (!req.body || !req.body.streaming || req.body.streaming === 'false') {
res.setHeader('Content-Type', 'application/json')
res.status(displayedError.statusCode).json(displayedError)
}