wrjlewis / notion-search-alfred-workflow

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

Setup issues #38

Closed janacm closed 2 years ago

janacm commented 2 years ago

I'm unable to get this workflow to work. I had it working in the past, but I seem to be doing something wrong now.

I'm a developer - is there some way I can check logs? Also, when inputting the cookie/space-id into the alfred var, should it be quoted?

Screenshots image

Workflow Version: 0.4.0

image

My full cookie (I replaced some of the sensitive info with <OBFUSCATED>

notion_browser_id=99fd5b<OBFUSCATED>f602f89; NEXT_LOCALE=en-US; intercom-id-gpfdrxfd=bd90d49<OBFUSCATED>490052199f; notion_experiment_device_id=8309b57b<OBFUSCATED>c946c4; notion_check_cookie_consent=false; logglytrackingsession=dbb5042a-ca7b-4279-a5db-fc86eaa6a134; notion_locale=en-US/autodetect; csrf=6becef78-c5cc-48c0-8de6-d3f28addac78; token_v2=c2ba0d5<OBFUSCATED>cf4d51e68cdf92afe5<OBFUSCATED>d58d721b64d7; notion_user_id=695eb69<OBFUSCATED>45245bfb; notion_users=[%22d<OBFUSCATED>c-bf4<OBFUSCATED>6c%22%2C%22695eb691-59<OBFUSCATED>45245bfb%22]; ajs_group_id=ce8a23ba<OBFUSCATED>e1ff4bf; ajs_anonymous_id=99fd5<OBFUSCATED>8f602f89; intercom-session-gpfdrxfd=d1NPQ<OBFUSCATED>U4MkJCUGVoUU5sc3piUT09--408a3cd<OBFUSCATED>38ffe049db43; amp_af43d4=99fd5b504c21<OBFUSCATED>602f89.Njk1ZW<OBFUSCATED>YyMmExNDUyNDViZmI=..1fr<OBFUSCATED>0.1frn4ahev.22.p.2r

Any suggestions for how I can debug this would be much appreciated!

wrjlewis commented 2 years ago

I recently migrated this to python3 because 2 is deprecated in the next version of macOS to be made public. Is it possible you haven't got python3 installed? You can check by running python3 in the command line. Although if you haven't got it installed it should come up with a prompt to install alongside mac developer tools. I'm out at the moment but there are logs in Alfred I can point you too, though very limited

janacm commented 2 years ago

Thanks for the response - I have Python 3.8.2 installed. Any other suggestions? On Feb 12, 2022, 9:43 AM -0500, Will Lewis @.***>, wrote:

I recently migrated this to python3 because 2 is deprecated in the next version of macOS to be made public. Is it possible you haven't got python3 installed? You can check by running python3 in the command line. Although if you haven't got it installed it should come up with a prompt to install alongside mac developer tools. I'm out at the moment but there are logs in Alfred I can point you too, though very limited — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

wrjlewis commented 2 years ago

If you open Alfred preferences, select the workflow, in the top right corner near the env variables icon is a bug icon, click that and you’ll se the log screen appear. Try a search again and please let me know what gets logged? I’m also presuming you’ve entered the workspace id in env variables already.

On Sat, 12 Feb 2022 at 17:28, janac meena @.***> wrote:

Thanks for the response - I have Python 3.8.2 installed. Any other suggestions? On Feb 12, 2022, 9:43 AM -0500, Will Lewis @.***>, wrote:

I recently migrated this to python3 because 2 is deprecated in the next version of macOS to be made public. Is it possible you haven't got python3 installed? You can check by running python3 in the command line. Although if you haven't got it installed it should come up with a prompt to install alongside mac developer tools. I'm out at the moment but there are logs in Alfred I can point you too, though very limited — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

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

nickxma commented 2 years ago

I had version 4.0 working well too for a while but it just stopped today 😕

Here are my logs

[14:30:14.286] Logging Started...
[14:30:16.072] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.F03DFA41-9BF8-45C5-8DDC-3B8D42F227A1%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument ''
[14:30:16.427] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.F03DFA41-9BF8-45C5-8DDC-3B8D42F227A1%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[14:30:16.432] ERROR: Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.F03DFA41-9BF8-45C5-8DDC-3B8D42F227A1%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Code 1: Traceback (most recent call last):
  File "notion.py", line 191, in <module>
    for x in searchResults.pages:
AttributeError: 'Payload' object has no attribute 'pages'[14:30:14.286] Logging Started...
[14:30:16.072] Notion Search[Script Filter] Queuing argument ''
[14:30:16.427] Notion Search[Script Filter] Script with argv '(null)' finished
[14:30:16.432] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last):
  File "notion.py", line 191, in <module>
    for x in searchResults.pages:
AttributeError: 'Payload' object has no attribute 'pages'
wrjlewis commented 2 years ago

Hi @nickokgo and @janacm (presuming you share the same error)

Thanks for providing those logs, very helpful.

I've made a change to the workflow which should fix this issue.

If you haven't already downloaded the latest version automatically, get it here.

If you are still seeing an error set the (just added to this version) env variable showRecentlyViewedPages to false, and that should do the trick.

Let me know how you get on. Thanks, Will.

nickxma commented 2 years ago

Yep! Back working 😎

Thanks for the excellent support!

PS showRecentlyViewedPages is working

wrjlewis commented 2 years ago

Yep! Back working 😎

Thanks for the excellent support!

PS showRecentlyViewedPages is working

Pleased to hear! 🙌

janacm commented 2 years ago

Darn, same issue except slightly different error message:

image

This is using v0.4.1 I also updated the cookie var just to be safe.

My logs:

[09:42:05.115] Logging Started...
[09:42:09.558] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument ''
[09:42:09.888] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[09:42:09.890] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}
[09:42:10.065] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 't'
[09:42:10.138] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 'te'
[09:42:10.188] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 'tes'
[09:42:10.283] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 'test'
[09:42:10.521] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[09:42:10.524] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}
[09:42:13.943] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[09:42:13.948] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}
wrjlewis commented 2 years ago

Darn, same issue except slightly different error message:

image

This is using v0.4.1 I also updated the cookie var just to be safe.

My logs:

[09:42:05.115] Logging Started...
[09:42:09.558] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument ''
[09:42:09.888] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[09:42:09.890] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}
[09:42:10.065] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 't'
[09:42:10.138] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 'te'
[09:42:10.188] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 'tes'
[09:42:10.283] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument 'test'
[09:42:10.521] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[09:42:10.524] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}
[09:42:13.943] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[09:42:13.948] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.872B806A-7F66-4BD8-9E7D-A30FFA1ECA54%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]}

And just to confirm, you have the workspace ID populated in the env variable too?

circumeo commented 2 years ago

I'm using the 0.4.1 version, but it's not working 😭

[19:27:03.550] Logging Started...
[19:27:05.081] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument ''
[19:27:05.536] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[19:27:05.538] ERROR: Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Code 1: Traceback (most recent call last):
  File "notion.py", line 198, in <module>
    for x in searchResults.pages:
AttributeError: 'Payload' object has no attribute 'pages'
wrjlewis commented 2 years ago

I'm using the 0.4.1 version, but it's not working 😭

[19:27:03.550] Logging Started...
[19:27:05.081] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument ''
[19:27:05.536] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[19:27:05.538] ERROR: Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Code 1: Traceback (most recent call last):
  File "notion.py", line 198, in <module>
    for x in searchResults.pages:
AttributeError: 'Payload' object has no attribute 'pages'

Hi.

Your error indicated that the 'showRecentlyViewedPages' call isn't working.. not sure why that is but can you try turning off that feature?

Set env variable showRecentlyViewedPages to false.

Does this remove the error and allow you to search as normal? @circumeo

Thanks

janacm commented 2 years ago

Hi,

I tried setting to False and still doesn't work, unfortunately. Also, by workspace ID do you mean the notionSpaceId? If so, then yes I have that set as well:

image

image

circumeo commented 2 years ago

I'm using the 0.4.1 version, but it's not working 😭

[19:27:03.550] Logging Started...
[19:27:05.081] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Queuing argument ''
[19:27:05.536] Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Script with argv '(null)' finished
[19:27:05.538] ERROR: Notion Search[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.BD2328E9-A9C1-432D-888C-A8762FE17F5C%3E7DD3BDE5-A157-42E5-9376-F681FB50A4EE)] Code 1: Traceback (most recent call last):
  File "notion.py", line 198, in <module>
    for x in searchResults.pages:
AttributeError: 'Payload' object has no attribute 'pages'

Hi.

Your error indicated that the 'showRecentlyViewedPages' call isn't working.. not sure why that is but can you try turning off that feature?

Set env variable showRecentlyViewedPages to false.

Does this remove the error and allow you to search as normal? @circumeo

Thanks

The search function does not work even if the 'showRecentlyViewedPages' setting is changed to false 😭

스크린샷 2022-02-21 오후 4 00 48

wrjlewis commented 2 years ago

Hmmmmm this is unfortunately very hard to debug without seeing what the response from the call to Notion is. I should really implement some kind of logging system so this could be easier.

I don't know if you'd be willing to do so, but there is a way you could help debug this which would be appreciated and could lead me to get this working again for you, if you don't mind editing a part of the workflow file.

1) Right click the workflow in Alfred Preferences, in the left hand menu, and choose 'Open in Finder'. 2) Edit notion.py and add the following after line 219, which is after the line that reads data = response.read(), matching the indentation of the surrounding code:

file = open("request_log.txt", "w")
file.write(data.decode("utf-8"))
file.close()

3) Try a couple of notion searches with the workflow. 4) Go back to finder and find request_log.txt, which is in the same directory as notion.py and check its contents. 5) Strip out any sensitive information and send me the file/contents so I can see, perhaps to my email rather than here will@willlewis.co.uk, or let me know if there are obvious errors there.

It might also be helpful to know what version of python3 you are running? python3 --version

Note: If you want revert all the changes above, simply re-download the workflow. @circumeo

circumeo commented 2 years ago

I'm working on it because I can't run the .py file due to another problem 😓 But thank you so much for the detailed explanation! My Python version is 3.8.9

wrjlewis commented 2 years ago

Thanks very much, remember instead of running the python file by itself, use the workflow to trigger it so it’s got all the right context 👍

On Wed, 23 Feb 2022 at 06:49, circumeo @.***> wrote:

I'm working on it because I can't run the PY file due to another problem 😓 But thank you so much for the detailed explanation! My Python version is 3.8.9

— Reply to this email directly, view it on GitHub https://github.com/wrjlewis/notion-search-alfred-workflow/issues/38#issuecomment-1048490924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALY3SUN5NJEKB6LBVB4H3DU4R7PVANCNFSM5OG53BYA . You are receiving this because you were assigned.Message ID: @.***>

wrjlewis commented 2 years ago

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.

vendetta677 commented 2 years ago

I am having the same problem

Screen Shot 2022-03-23 at 9 14 53 AM Screen Shot 2022-03-23 at 9 14 49 AM

:

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.

geekbb commented 2 years ago

Snipaste_2022-04-02_08-43-11 同样的问题

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

Yeah, I used to use the Notion search in Alfred every day. I upgraded to a MacBook Pro a few days ago and suddenly noticed that I couldn't get this Workflow to work. I get this in the debug console:

[14:40:52.245] Notion Search[Script Filter] Queuing argument '' [14:40:52.315] Notion Search[Script Filter] Script with argv '(null)' finished [14:40:52.319] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "arg": "notion://www.notion.so/"}]} [14:40:54.023] Notion Search[Script Filter] Queuing argument 'b' [14:40:54.095] Notion Search[Script Filter] Script with argv '(null)' finished [14:40:54.098] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last): File "notion.py", line 216, in <module> conn.request("POST", "/api/v3/search", File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 1293, in _send_request self.putheader(hdr, value) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 1225, in putheader values[i] = one_value.encode('latin-1') UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 512: ordinal not in range(256)

I had no trouble getting the cookie and space ID info. I've got the 'show recently viewed' set to false, just in case it helps. The last time I set up this Workflow it was working as soon as the variables were saved. What a bummer it's currently broken...

I did initially get a prompt to install Python btw, which I accepted. I've also manually installed the latest version of Python on my system. Running Monterey 12.3.1 and Alfred 4.6.4.

wrjlewis commented 2 years ago

@BrynWithin @geekbb Did you manage to get it working in the end? Both looks like something funky going on with encoding.

wrjlewis commented 2 years ago

Closing this issue for now to clean up, we should reopen new issues to capture any specific problems you are facing, please.