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
assert.js:85
throw new assert.AssertionError({
^
AssertionError: false == true
at Connection._send (/Users/vikaton/Desktop/speech2text/node_modules/http2/lib/protocol/connection.js:326:9)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
when running this function
functionpost(audioBuffer){returnnewPromise((resolve,reject)=>{// some headers and contentletreq=require('http2').request(options,function(res){console.log("CALLBACK HAS BEEN CALLED BACK")console.log(res.statusCode)if(res.statusCode>204){console.log("ERR with return code "+res.statusCode)req.end('',function(){console.log('ended request cause of bad code')})reject('BAD CODE')}elseif(res.statusCode==204){in_session=falseplayer.play('204.mp3',function(err){if(err)throwerr})reject('NO REPSONSE').// usually this doesnt fire cause I get The assertion error here}streamToBuffer(res,function(err,buffer){console.log('response',buffer.length);if(err){console.error('error',err);returnfalse;}letparsedMessage=httpParser(buffer);varmultipart=parsedMessage.multipart;if(Array.isArray(multipart)){multipart.forEach(function(part){//console.log(part)varheaders=part.headers;varbodyBuffer=part.body;varcontentType=_.get(headers,'Content-Type');if(bodyBuffer){if(contentType==='application/octet-stream'){fs.writeFileSync('audio.mp3',bodyBuffer)player.play('audio.mp3',function(err){if(err)throwerrin_session=falseresolve('SUCCESS')})}elseif(contentType==='application/json'){varbody=JSON.parse(bodyBuffer.toString('utf8'));console.log(body)//bookmark}}});}});req.on('error',function(e){console.log('problem with request: '+e.message);});req.setTimeout(5000,function(){in_session=falseconsole.log('timed out')})});console.log('REQ IS '+req)if(isStream(audioBuffer)){streamToBuffer(audioBuffer,function(error,buffer){if(error){console.error(error);returnfalse;}sendRequest(buffer);//check before this});}elseif(isBuffer(audioBuffer)){sendRequest(audioBuffer);}else{console.error('Audio buffer invalid');}functionsendRequest(audBuffer){console.log('should sent data')req.write(postDataStart);console.log(postDataStart)req.write(audBuffer);console.log(audBuffer)req.write(postDataEnd);console.log(postDataEnd)req.end(null,function(){console.log('ended request and sent data')})}})}
My question is, what is the underlying cause for this error in the code (if its even the code thats the problem) and how can I avoid it?
The text was updated successfully, but these errors were encountered:
At times I would get this error:
when running this function
My question is, what is the underlying cause for this error in the code (if its even the code thats the problem) and how can I avoid it?
The text was updated successfully, but these errors were encountered: