You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using multer to produce a small proof of concept I came across this bug.
Node throws me an error 'Cannot read property 'send' of null '
app.post('/upload',async(req,response)=>{letfinalResponse=response;awaitupload(req,response,err=>{fs.readFile(`./uploads/${req.file.originalname}`,async(error,data)=>{interpretAndSend(data,finalResponse);});});});asyncfunctioninterpretAndSend(imgData,res){awaitworker.load();awaitworker.loadLanguage('eng');awaitworker.initialize('eng');const{data: { text },}=awaitworker.recognize(imgData);awaitworker.terminate();<-----IssueHereres.send(text);}
The first time i call the route everything works fine. When i try to pass a file to the route a second time I get the error in the console. I managed to track it down to worker.terminate();
If I comment out worker.terminate(); then the app works fine, no idea what the route cause of it is.
The text was updated successfully, but these errors were encountered:
When you can Worker.terminate(), it will terminate the child_process (web worker in browser) in the background, which makes this worker unusable, that's why it fails to execute in the second run.
Using multer to produce a small proof of concept I came across this bug.
Node throws me an error 'Cannot read property 'send' of null '
The first time i call the route everything works fine. When i try to pass a file to the route a second time I get the error in the console. I managed to track it down to worker.terminate();
If I comment out worker.terminate(); then the app works fine, no idea what the route cause of it is.
The text was updated successfully, but these errors were encountered: