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

Invalid server response #1

Closed
cahukS opened this issue Mar 31, 2018 · 23 comments
Closed

Invalid server response #1

cahukS opened this issue Mar 31, 2018 · 23 comments
Assignees

Comments

@cahukS
Copy link

cahukS commented Mar 31, 2018

When I enter my Pinboard credentials, I get a notification that the credentials are successfully set but after a few seconds I get a new notification about invalid server response (invalid port number....; I can't see the entire log message; here is a screenshot on Dropbox).

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

can you please run the following commands in terminal and post the output here?

./alfred-pinboard-rs config -a your_username:api_token
./alfred-pinboard-rs config update

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

I get this after running ./alfred-pinboard-rs update:

{"items":[{"icon":{"path":"erroricon.icns"},"subtitle":"invalid server response: invalid port number at line 3353 column 57","title":"Error"}]}⏎

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

ok, run this to see if you can actually talk to Pinboard server without using this workflow:

curl https://api.pinboard.in/v1/posts/all\?auth_token\=your_username:api_token > pins.xml

pins.xml should then contain all your bookmarks.

@spamwax spamwax self-assigned this Apr 1, 2018
@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

The curl command works, downloaded my bookmarks.

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

ok, I am guessing that there is a text encoding issue related to one of the bookmarks you have based on the "line 3353 column 57".
However I am not sure why it's talking about "invalid port number"
To better debug, I may need to introduce more verbose logging to code but for now, you can run this and I'll try to see where the error is happening based on what output you get:

RUST_LOG=rusty_pin=debug,alfred_pinboard_rs=debug ./alfred-pinboard-rs update

By the way, does your Pinboard user name have any non-ASCII character?

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs: Parsing input arguments. DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs: Deciding on which command branch DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs: Starting in setup DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs::workflow_config: Starting in setup DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs::workflow_config: Starting in get_workflow_dirs DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs::workflow_config: Starting in read DEBUG 2018-04-01T08:47:18Z: alfred_pinboard_rs::workflow_config: Starting in get_alfred_version DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard: pinb::new: calling CachedData::new DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::cached_data: new: starting DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::cached_data: create_cache_dir: starting DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::cached_data: load_cache_data_from_file: starting DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::cached_data: cache_ok: starting DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard: pinb::new: cache file missing, calling update DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::cached_data: update_cache: starting DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::api: all_pins: starting. DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::api: get_api_response: starting. DEBUG 2018-04-01T08:47:18Z: rusty_pin::pinboard::api: add_auth_token: starting. DEBUG 2018-04-01T08:47:39Z: alfred_pinboard_rs: Starting in show_error_alfred {"items":[{"icon":{"path":"erroricon.icns"},"subtitle":"invalid server response: invalid port number at line 3353 column 57","title":"Error"}]}

No non-ASCII character in my username.

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

when you do ./alfred-pinboard-rs config -a your_username:api_token
the last part should look like this: cahukS:3622E6 , i.e. user name followed by a colon : and then api token with hex number

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

Yes, I'm doing it that way.

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

According to the log you posted, problem happens when adding your authorization token to the url we send to Pinboard. Maybe when you were using Alfred to setup up this workflow using pa command something went wrong.

Check the settings.json file in ~/Library/Application Support/Alfred 3/Workflow Data/cc.hamid.alfred-pinboard-rs folder. There should be a key in that file named auth_token. Check its value, it should be username:token with no spaces and no-ascii characters.
Mines looks like this: "auth_token":"spamwax:AEBBBFBB3BB0BBBBB"

If that looks okay and you still get the same error message, you can then fully delete these two folders and try setting up the workflow again by using pa username:token in Alfred's window.
~/Library/Application Support/Alfred 3/Workflow Data/cc.hamid.alfred-pinboard-rs
~/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/cc.hamid.alfred-pinboard-rs

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

Ok, I deleted the two folders and ran the update command without setting the auth token. I got the same error - invalid port number. Is this strange?

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

after you delete the folders you need to do one-time setup of the workflow.
Trigger Alfred window, and in its window type pa followed by your username:token
make sure there are no spaces after the token, something like this in Alfred's window:
pa cahukS:0123456789ABCDEF

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

What I want to say is that even if I set the token the error is the same. Perhaps Alfred doesn't read the settings JSON?

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

I'd guess it is reading it but somehow your settings file is not following the required format.

Download this alfred-pinboard-rs and copy it in the workflow's folder. Then run this and see if the token that is printed in the log matches what you entered when setting up the Workflow:

RUST_LOG=rusty_pin=debug,alfred_pinboard_rs=debug ./alfred-pinboard-rs update

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

What is the path for the workflow?

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

actually you don't need to copy it to workflow's path. If it is in ~/Download, you can do this:

cd ~/Downloads
chmod u+x alfred-pinboard-rs
./alfred-pinboard-rs config -a your_username:api_token
RUST_LOG=rusty_pin=debug,alfred_pinboard_rs=debug ./alfred-pinboard-rs update

On my machine, the path for workflow is:
~/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.665EAB20-5141-463D-8C5A-90093EEAA756

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

I think there is a progress.

DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard: pinb::new: calling CachedData::new DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::cached_data: new: starting DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::cached_data: create_cache_dir: starting DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::cached_data: load_cache_data_from_file: starting DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::cached_data: cache_ok: starting DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard: pinb::new: cache file missing, calling update DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::cached_data: update_cache: starting DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::api: all_pins: starting. DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::api: get_api_response: starting. DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::api: add_auth_token: starting. DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::api: token: username:token DEBUG 2018-04-01T21:13:30Z: rusty_pin::pinboard::api: url: "https://api.pinboard.in/v1/posts/all?format=json&auth_token=username%3token" {"items":[{"icon":{"path":"erroricon.icns"},"subtitle":"invalid server response: invalid port number at line 3353 column 57","title":"Error"}]}⏎

As you see there now two new lines after add_auth_token: starting

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

It seems you are not using your actual user name and token from Pinboard.
Go to your settings page on Pinboard to retrieve your authentication token and exactly use that in Alfred's window to set up this workflow.
Seems you missed installation instructions on front page.

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

or if I am mistaking and you modified the log before posting, then I have to work on more logging

@cahukS
Copy link
Author

cahukS commented Apr 1, 2018

I modified the log before posting.

@spamwax
Copy link
Owner

spamwax commented Apr 1, 2018

ok, let's see what we get from this new binary. After downloading it do the same thing as above:

cd ~/Downloads
chmod u+x alfred-pinboard-rs
./alfred-pinboard-rs config -a your_username:api_token
RUST_LOG=rusty_pin=debug,alfred_pinboard_rs=debug ./alfred-pinboard-rs update

Post the output here.
If you get the same error message, then run this:

 curl https://api.pinboard.in/v1/posts/all\?format\=json\&auth_token\=your_username:api_token > bookmarks.json

(don't forget to replace username/token in above with yours)

Goto to line 3353 of bookmarks.json, and if you don't mind share that line and couple of its surroundings with me. If you don't wanna share those particular bookmarks, then delete them from your Pinboard account on their website (after backing up) and see running an update would get it fixed or not.

@cahukS
Copy link
Author

cahukS commented Apr 2, 2018

{"href":"http:\/\/Pico%20-%20A%20stupidly%20simple,%20blazing%20fast,%20flat%20file%20CMS.:%20http:\/\/picocms.org\/","description":"","extended":"via DuckDuckGo for iOS","meta":"e6e8a68d0648130418cc13a5284836de","hash":"7f71fe3f14cc89de8e08606b21486298","time":"2014-08-08T21:33:38Z","shared":"no","toread":"no","tags":"Sent from my iPhone"},

This is line 3353.

{"href":"http:\/\/www.tobeannounced.org\/2014\/08\/keeping-freebsd-up-to-date\/","description":"Keeping FreeBSD up-to-date | To Be Announced","extended":"","meta":"ef5f15b3c91f63582dd531e5df8ed769","hash":"4c5eb65b98748b7622b95fde9b05780e","time":"2014-08-09T12:48:41Z","shared":"no","toread":"no","tags":"freebsd unix"},

{"href":"http:\/\/oreilly.com\/catalog\/opensources\/book\/appa.html","description":"Appendix A - The Tanenbaum-Torvalds Debate","extended":"","meta":"083ed0eaf57ac959258fe97a43ca3f3c","hash":"15c9d482098e8f1fa69ae3403a5ffd43","time":"2014-08-09T12:47:53Z","shared":"no","toread":"no","tags":"linux kernel history"}

{"href":"http:\/\/statiked.com\/","description":"Statiked:Creating Static Blogs Made Easy!","extended":"","meta":"92351c11d494f44fc992dd5b100d53c4","hash":"9ecff23cab131c955fbdfed1f4f450da","time":"2014-08-08T21:15:56Z","shared":"no","toread":"no","tags":"Sent from my iPhone"}

{"href":"http:\/\/getkirby.com\/","description":"Kirby \u2013 Home","extended":"","meta":"2cd1fa3922970d56671035504dcf5491","hash":"d742d3af61b9b3c8b9d549111fbbaa3c","time":"2014-08-08T20:57:42Z","shared":"no","toread":"no","tags":"cms php"},

And a few lines surrounding it.

I deleted the original bookmark from line 3353 but the same number line still causes the error.

@cahukS
Copy link
Author

cahukS commented Apr 2, 2018

Ok, everything is fixed now. I had a few bookmarks with wrong URL syntax. Deleted those bookmarks from Pinboard and now Alfred shows the bookmarks. Thank you very much for your help.

@spamwax
Copy link
Owner

spamwax commented Apr 2, 2018

great!

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

2 participants