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

Protobuf error - Error: Parse error at line 1: unexpected ' #109

Closed
Psycho345 opened this issue Jun 1, 2017 · 6 comments
Closed

Protobuf error - Error: Parse error at line 1: unexpected ' #109

Psycho345 opened this issue Jun 1, 2017 · 6 comments

Comments

@Psycho345
Copy link

Psycho345 commented Jun 1, 2017

/nodesteamuser/node_modules/protobufjs/dist/protobuf.js:784
throw e;
^
Error: Parse error at line 1: unexpected '�

That character at the end is ETX.

I tried:

  • reinstalling everything 10 times,
  • basicbot.js example,
  • different node versions,
  • installing manually,
  • copy-pasting protobufs from this git,
  • this fix (It 'works' but doesn't even log in).

Something must be broken.

@welwood08
Copy link
Contributor

welwood08 commented Jul 11, 2017

I also encountered this as soon as I require('steam-user').

It looks like ./components/protobufs.js is trying to load ./protobufs/google as if it were a file when it is in fact a directory. The fix linked above would seem to agree with me.

What is the intended behaviour here? Obviously directories shouldn't be assumed to be files in any case, but does the loading need to be recursive (presumably if login doesn't work with the patch then yes)? Was #50 closed because the issue couldn't be reproduced?

@DoctorMcKay
Copy link
Owner

What operating system are both of you on?

@welwood08
Copy link
Contributor

I was testing my code in a jail on a FreeNAS server when I encountered the problem. I just tried running exactly the same code on a Windows machine via a network share - it does not produce the error. OP of #50 appears to have been using a Ubuntu machine, so *nix vs Windows seems to be the common element indeed.

@DoctorMcKay
Copy link
Owner

All my deployments end up on Linux (Ubuntu and CentOS specifically) so it doesn't seem like it's definitely Linux's fault.

@welwood08
Copy link
Contributor

welwood08 commented Jul 11, 2017

Following the breadcrumbs, looks like Protobuf.loadProtoFile expects Protobuf.Util.fetch to return null in the case of an error reading the file. That function only returns null if fs.readFile* generates an exception, which it seems to do on my Windows machine. In my FreeBSD jail, it succeeds with <Buffer 03 00 00> when reading the google directory as a file. Bug in this old version of protobuf.js? Bug in node?

Edit: seems node already knew it was platform-specific behaviour and recently documented it for fs.readFile*, see nodejs/node#10962.
So I guess bug in protobuf.js relying on platform-specific behaviour then, unlikely to be fixed in 5.x series when they're up to 6.8.0 already. In light of this, I guess the fix from #50 is the correct solution?

Edit2: after applying the fix and implementing login code, I'm able to successfully login from my FreeBSD jail. OP's login problem must be something else.

@Psycho345
Copy link
Author

I also run it on FreeBSD. I checked everything again and I can confirm that the fix works. I've probably broken something while playing with the files first time.

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

3 participants