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

Parse error on container.run() #17

Open
woubuc opened this issue Apr 22, 2018 · 11 comments
Open

Parse error on container.run() #17

woubuc opened this issue Apr 22, 2018 · 11 comments
Assignees

Comments

@woubuc
Copy link

woubuc commented Apr 22, 2018

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);
});
@alandoherty
Copy link
Owner

Looking into it now, but can't seem to replicate. Can you provide any more information on your setup?

@alandoherty alandoherty self-assigned this May 11, 2018
@woubuc
Copy link
Author

woubuc commented May 11, 2018

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

@anthonyloukinas
Copy link

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' }

@lpgera
Copy link

lpgera commented Jul 19, 2018

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'

@alandoherty
Copy link
Owner

@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

@lpgera
Copy link

lpgera commented Jul 19, 2018

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.

@lpgera
Copy link

lpgera commented Jul 20, 2018

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.

@tomevoll
Copy link

tomevoll commented Jul 28, 2018

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' }

@tomevoll
Copy link

tomevoll commented Jul 28, 2018

Is there any solution that works for this? Anyone know of a different lib i could use to exec ?

@3xtr3m3d
Copy link

3xtr3m3d commented Feb 1, 2019

any solution?

@3xtr3m3d
Copy link

3xtr3m3d commented Feb 1, 2019

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).

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

6 participants