wrjlewis / notion-search-alfred-workflow

An Alfred workflow to search Notion with instant results
GNU General Public License v3.0
828 stars 41 forks source link

Probably not a bug - but I've been trying to make this work for 4 hours #41

Closed danMulligan closed 2 years ago

danMulligan commented 2 years ago

the closest thing I could find resembling a "notionSpaceId" was at the bottom of the "x-notion-active-user-header" at the bottom of the Request Headers - in Firefox - I started in Chrome, then Safari... sorry, no clue about API whatsoever.

Four hours of trial and error later, here's the bug report:

[00:31:25.633] Notion Search[Script Filter] Queuing argument '' [00:31:25.711] Notion Search[Script Filter] Script with argv '(null)' finished [00:31:25.717] ERROR: Notion Search[Script Filter] Code 127: /bin/bash: python3: command not found

please advise, this has broken me. thanks, Dan

wrjlewis commented 2 years ago

Hey

The error indicates that python3 isn't installed on your system, and it's required by the workflow.

When you tried running the workflow, it should have come up with a prompt to install developer tools (which includes python3), does that happen?

If not, try opening terminal, an application that can be found in 'Applications' within finder. Type
xcode-select --install and press enter. This should trigger the prompt that asks you to install developer tools.

In regards to the spaceId. In chrome you can find it as seen in the screenshot below, you'll see 'search' on the left hand side, this will be there and selectable if you try a notion quick search, while you've got the developer window open. Then you can find the spaceId in the request payload area.

image

danMulligan commented 2 years ago

Hi Will, thanks for replying. I didn't realise it needed Python 3.

I'm running Hi Sierra still so I followed a tutorial for that. And ended up building a whole python "environment" or something ala Homebrew, Xcode et al.

I can't work out how to make it default to Python 3 instead of the pre-installed v2.7... Redirect the v3 directory to the top of the path. Something to do with Bash... here

I'm gonna have to take the long view on solving this. I have other life priorities atm :/ thanks for getting in touch

wrjlewis commented 2 years ago

I can't work out how to make it default to Python 3 instead of the pre-installed v2.7...

The workflow automatically runs python3, so you don't need to do anything else on this. It's hardcoded into the workflow to run the python3 command.

Did you try 'xcode-select --install' in the terminal?

Thanks

danMulligan commented 2 years ago

Screen Shot 2022-02-26 at 20 41 22 Screen Shot 2022-02-26 at 21 46 49 Screen Shot 2022-02-26 at 22 22 16 Screen Shot 2022-03-03 at 14 44 23

Hi Will, I got as far as installing Python 3 via https://www.python.org/download/releases/3.0/ That didn't get me far. Because Terminal kept saying it was running 2.7 still

After that I resorted to the whole "build" thing ala that guys video. So I installed homebrew, xcode9, CommandLineTools and Python directly within Terminal.

Still couldn't get it to over ride v2.7 Still got nowhere within Alfred...

wrjlewis commented 2 years ago

I deleted your previous message with the screenshots in case it contained sensitive information (token and cookie..)

When you run python you explicitly tell the terminal to run python 2. My workflow uses the command python3 which will run python3. So if you were to type python3 into your terminal, you'll find you won't see any reference to python 2.7, and probably you've installed python3 perfectly well.

For some reason Alfred isn't finding python3 in the right place, I suspect.

This is a bit of a hack that should get it working, based on what you've said:

Open Alred Preferences, click on the notion workflow, double click on the script filter box (with the notion icon), under 'script' replace python3 with /usr/local/bin/python3 so it looks like this: /usr/local/bin/python3 notion.py "{query}"

danMulligan commented 2 years ago

Hi Will, many thanks... nearly there. After adding the hack it's the first time the search bar / keyword has resulted in the NS icon appearing! Unfortunately the search itself was a disaster...

What does all this mean do you recon? Incorrectly configured? (This is the abridged version repeating the same "error notion search" and "SSL certificate failure")

Thanks for the assistance!

[16:57:05.440] Notion Search[Script Filter] Queuing argument 'a' [16:57:05.592] Notion Search[Script Filter] Queuing argument 'ac' [16:57:05.679] Notion Search[Script Filter] Script with argv '(null)' finished [16:57:05.683] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last): File "/Users/imac-2011/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.253436AD-178C-43F6-880E-837FB84B361D/notion.py", line 216, in conn.request("POST", "/api/v3/search", File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1279, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1325, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1274, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1034, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 974, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1448, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

Screen Shot 2022-03-03 at 16 57 30

wrjlewis commented 2 years ago

Hmmmm, I'm not familiar with this error, something to do with the different way you've installed Python perhaps but I would suggest trying this, which came up when I googled the solution:

image

^ Can you find that same Python folder, within your Applications folder? If so double click the highlighted Install Certificates file, and you should be good from then on.

danMulligan commented 2 years ago

It's Alive! Thank you so much Will! The SSL certificate has made all the difference. I can't believe it. The ability to trawl through and immediately access anything within my Notion. That's a very noble gift you've given to humanity. I sponsored you ten bucks$ for your help today. Really appreciated the guidance.

thanks Dan

wrjlewis commented 2 years ago

It's Alive! Thank you so much Will! The SSL certificate has made all the difference. I can't believe it. The ability to trawl through and immediately access anything within my Notion. That's a very noble gift you've given to humanity. I sponsored you ten bucks$ for your help today. Really appreciated the guidance.

thanks

Dan

More than welcome and thank you very much, I really appreciate it. I'm very glad it's working and we persevered to get to the good result πŸ™Œ. Thanks for you support.

If I ever update the workflow and it stops working again for you, the only step you'd need to do again is the bit where you updated python3 to /usr/local/...

bymilano commented 2 years ago

Hey Will, I followed all the steps but I'm still unable to use the workflow because I get this every time I search for something:

image

Here is the bug report from running that test if that helps:

[18:30:16.471] Logging Started... [18:30:18.771] Notion Search[Script Filter] Queuing argument '' [18:30:18.840] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:18.843] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]} [18:30:19.008] Notion Search[Script Filter] Queuing argument 't' [18:30:19.159] Notion Search[Script Filter] Queuing argument 'te' [18:30:19.320] Notion Search[Script Filter] Queuing argument 'tes' [18:30:19.484] Notion Search[Script Filter] Queuing argument 'test' [18:30:19.754] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:19.760] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}

Please let me know if you have any ideas on why this is happening!

danMulligan commented 2 years ago

hi Will, sorry to be the bearer of bad news... Do you know the issue where it appears to be working but it only ever finds the same page over and over...? Something's over-riding the actual page I've asked to visit. Like it's assigned a homepage and keeps sending me to there.

wrjlewis commented 2 years ago

hi Will, sorry to be the bearer of bad news... Do you know the issue where it appears to be working but it only ever finds the same page over and over...? Something's over-riding the actual page I've asked to visit. Like it's assigned a homepage and keeps sending me to there.

That is bizarre... is it still happening?

Just to check, have you tried updating the token (by copying and pasting it again)?

wrjlewis commented 2 years ago

Hey Will, I followed all the steps but I'm still unable to use the workflow because I get this every time I search for something:

image

Here is the bug report from running that test if that helps:

[18:30:16.471] Logging Started... [18:30:18.771] Notion Search[Script Filter] Queuing argument '' [18:30:18.840] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:18.843] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]} [18:30:19.008] Notion Search[Script Filter] Queuing argument 't' [18:30:19.159] Notion Search[Script Filter] Queuing argument 'te' [18:30:19.320] Notion Search[Script Filter] Queuing argument 'tes' [18:30:19.484] Notion Search[Script Filter] Queuing argument 'test' [18:30:19.754] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:19.760] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}

Please let me know if you have any ideas on why this is happening!

Not sure why this wouldn't be working, though sometimes refreshing the token, by copying and pasting it, seems to fix things! Have you tried that? Is it still happening?

There are few issues cropping up with the workflow change to Python3 and the new Mac OS removing python2, that could be linked to some of these errors. To be sure I will need to add proper error logging to the workflow, one for the to-do list one of these weekends.

bymilano commented 2 years ago

I just copy and pasted the spaceID and it works now! For some reason, when I had the issue originally, copy and pasting did not make any difference but hey, I'm not complaining that it does now ahahah.

Thanks for your help Will!

wrjlewis commented 2 years ago

Haha brilliant, fingers crossed it stays that way πŸ˜„ glad it’s working

On Wed, 9 Mar 2022 at 12:26, bymilano @.***> wrote:

I just copy and pasted the spaceID and it works now! For some reason, when I had the issue originally, copy and pasting did not make any difference but hey, I'm not complaining that it does now ahahah.

Thanks for your help Will!

β€” Reply to this email directly, view it on GitHub https://github.com/wrjlewis/notion-search-alfred-workflow/issues/41#issuecomment-1062869793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALY3SWA4BQRIADU4Y75U3LU7CKIVANCNFSM5PLT5TZA . You are receiving this because you commented.Message ID: @.***>

wrjlewis commented 2 years ago

Is anyone still experiencing issues, after having the latets mac and alfred updates, and after updating the cookie? I would also suggest trying setting the showRecentlyViewedPages env variable to false, to see if that helps.

persusc commented 2 years ago

Hey Will, I followed all the steps but I'm still unable to use the workflow because I get this every time I search for something:

image

Here is the bug report from running that test if that helps:

[18:30:16.471] Logging Started... [18:30:18.771] Notion Search[Script Filter] Queuing argument '' [18:30:18.840] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:18.843] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]} [18:30:19.008] Notion Search[Script Filter] Queuing argument 't' [18:30:19.159] Notion Search[Script Filter] Queuing argument 'te' [18:30:19.320] Notion Search[Script Filter] Queuing argument 'tes' [18:30:19.484] Notion Search[Script Filter] Queuing argument 'test' [18:30:19.754] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:19.760] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}

Please let me know if you have any ideas on why this is happening!

Hi Will, I've also encountered this issue and tried to copy and paste both the values and it still doesn't work. I've updated the cookie and I've also tried setting the showRecentlyViewedPages env variable to false and it doesn't work either. Can you please help me? Thanks a lot man

Lishuoyy commented 2 years ago

Hello, I can use Alfred to search for content in notion, but the search results are only displayed for a second, and then disappear quickly and become No results, as shown in the following figure.

The debug information on which I run the test is as follows, how to solve it? I hope you can reply me. Thank you. image

eshchris commented 2 years ago

This likely isn't the issue others are facing but I was stuck for a while with the same error. Then I copied my cookie value and pasted it in Text Edit and discovered it was duplicated (I'd pasted it twice). So if anyone else is getting the No Results error, start by double-checking your cookie and SpaceID

wrjlewis commented 2 years ago

I'm going to close this issue as its been a while and there are potentially multiple issues here, if they are still being experienced. Please raise a new issue, if thats the case.