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

Unexpected token U #31

Closed
ritcoder opened this issue Aug 19, 2016 · 5 comments
Closed

Unexpected token U #31

ritcoder opened this issue Aug 19, 2016 · 5 comments
Labels

Comments

@ritcoder
Copy link

  • VSCode Version: 1.4.0
  • OS Version: Windows 10
  • REST Client Version: 0.7.2

Steps to Reproduce:

  1. Enter GET http://wwww.bing.com HTTP/1.1
  2. Ctrl-Alt-R

I get the error above. I was working find just a few minutes ago so not sure what could be the case.

R.

@Huachao
Copy link
Owner

Huachao commented Aug 19, 2016

@ritcoder this error seems normally happened at JSON.parse, which getting a parameter is undefined.

  • I want to confirm can you repro this error for other urls
  • you mean you can work earlier, and failed since some time, so I'd like you to check files(history.json and cookie.json) exist under this path %USERPROFILE%\.rest-client and whether they are real json
  • Can you toggle develop tools in vscode(Help -> Toggle Developer Tools) when running the command

Thanks for your reporting. And I can't repo in my machine by now

@Huachao Huachao added the bug label Aug 19, 2016
@ritcoder
Copy link
Author

I checked cookie.json and indeed, it did not contain correct json.

The ending of the file was

"www.bing.com":{"/":{"SRCHUID":{"key":"SRCHUID","value":"V=2&GUID=85BD4FE597F142D3A3D390D8330436C6","expires":"2018-08-19T11:39:50.000Z","domain":"www.bing.com","path":"/","hostOnly":true,"creation":"2016-08-19T11:39:50.778Z","lastAccessed":"2016-08-19T11:39:50.778Z" } } } }UIDB":{"key":"MUIDB","value":"1B8CFC8E99BA69BD33C2F5F898DC68BA", "expires":"2018-08-19T11:39:50.000Z","domain":"www.bing.com","path":"/","httpOnly":true, "hostOnly":true,"creation":"2016-08-19T11:39:50.780Z","lastAccessed":"2016-08-19T11:39:50.780Z"}}}}

Everything got back to normal after deleting the invalid part of the json.

UIDB":...

It is working now. Do you have any idea of what could have caused the invalid json to be written to the file?

@Huachao
Copy link
Owner

Huachao commented Aug 20, 2016

@ritcoder I think it may be the concurrency bug of the cookie store I used, see here. I will try to use other one.

@ritcoder
Copy link
Author

Cool. Now that I think about it, I was using it from two tabs. Anyway, will see if I can reproduce it and check with the next update. Thanks.

@Huachao Huachao closed this as completed Aug 22, 2016
@Huachao
Copy link
Owner

Huachao commented Aug 23, 2016

@ritcoder I have published the new version 0.7.3 which fixes the bug, you can have a try. 😃

vishalkuo added a commit to vishalkuo/request that referenced this issue Jul 6, 2018
Following this [issue](mitsuru/tough-cookie-filestore#3), it seems like `tough-cookie-filestore` has concurrency issues when saving to the file system resulting in incorrect JSON serialization [(see here)](Huachao/vscode-restclient#31). 

I used this README as a reference on how to persist cookies and ran into this concurrency bug as I used `tough-cookie-filestore` instead of `tough-cookie-file-store`. I'm proposing this change to prevent future users looking for the same functionality from encountering the same issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants