node-lxd
node-lxd copied to clipboard
Parse error on container.run()
When I try to run a command on my container, I get the following error:
Error: Parse Error
at Socket.socketOnData (_http_client.js:444:20)
at Socket.emit (events.js:127:13)
at addChunk (_stream_readable.js:269:12)
at readableAddChunk (_stream_readable.js:256:11)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onread (net.js:598:20)
My code:
container.run(['ls -al'], function(err, stdout, stderr) {
if (err) return console.error(err);
console.log('out:', stdout);
console.log('err:', stderr);
});
Looking into it now, but can't seem to replicate. Can you provide any more information on your setup?
We looked into the issue, I don't recall the specifics but it had something to do with the library not using secure websockets on windows. We patched it for our use case, see the added commits in https://github.com/epicteddy/node-lxd
Having this same exact issue attempting to do both a container.exec and a container.run. After I incorporated @woubuc's changes I get this error now.
{ Error: unable to verify the first certificate
at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
at emitNone (events.js:106:13)
at TLSSocket.emit (events.js:208:7)
at TLSSocket._finishInit (_tls_wrap.js:637:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
I am getting a similar error when trying to use container.run, but it also shows a HPE_INVALID_CONSTANT
code:
Error: Parse Error
at Socket.socketOnData (_http_client.js:440:20)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:597:20) bytesParsed: 0, code: 'HPE_INVALID_CONSTANT' } } reason: { Error: Parse Error
at Socket.socketOnData (_http_client.js:440:20)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:597:20) bytesParsed: 0, code: 'HPE_INVALID_CONSTANT'
@lpgera will look into it but it looks like that may be a transient error on your end, are you sure the target endpoint is correct? Also may be a incorrectly setup proxy inbetween
We had our own working implementation before, I am just trying to use this package because its control socket handling is better. So I don't think its a proxy or endpoint related problem. I'll try to narrow it down whether its a problem with the ws dependency.
It was the same problem that has been patched in https://github.com/epicteddy/node-lxd. The certificate was not used when it was connecting to the websockets.
same issue, i can create containers, delete them, start them, but can not run or execute anything in them. using https://github.com/epicteddy/node-lxd did not change a thing for me
Error: Parse Error at Socket.socketOnData (_http_client.js:440:20) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:607:20) bytesParsed: 0, code: 'HPE_INVALID_CONSTANT' }
Is there any solution that works for this? Anyone know of a different lib i could use to exec ?
any solution?
mmm, i solved problem for my case. added a pull request if anyone want (new to github and don't really know how pull requests and forks work).