AminSallah / Flow.Launcher.Plugin.Notion

Quick capture plugin for search, create, edit, and delete Notion pages.
MIT License
7 stars 0 forks source link

Cannot pick database for page creation or search #11

Open enoversum opened 1 month ago

enoversum commented 1 month ago

Hi Amin,

I hope you're overall doing well so far 😊. This time, I'm having a real 'issue' with your Notion plugin.

Whenever I try to select a Database for a search or page creation query, your plugin acts up. I am using 'n' as my activator.

  1. If I just type n @, no database is being shown or suggested. This worked before.
  2. If I type in n New page title @Notizen manually, in theory your plugin would create a page called 'New page title' in my 'Notizen' database. Your plugin response is 'Create', with the correct database in the second line, and it creates a new page without a title in said database.
  3. If I try to do the same and want to pick a database that begins with a '[' in its name, your plugin crashes with the error message below. Again, was working before :) .

Attached is a screenshot of my configuration that worked before, no idea what broke the database selection process :) .

image

All the best

Eno

Please open new issue in: https://github.com/AminSallah/Flow.Launcher.Plugin.Notion/issues

upload log file: D:\programme\FlowLauncher\app-1.18.0\UserData\Logs\1.18.0\2024-05-27.txt
copy below exception message
Flow Launcher version: 1.18.0
OS Version: 22635.3575
IntPtr Length: 8
x64: True

Python Path: D:\programme\FlowLauncher\app-1.18.0\UserData\Environments\Python\PythonEmbeddable-v3.11.4\pythonw.exe
Node Path: D:\programme\FlowLauncher\app-1.18.0\UserData\Environments\Node.js\Node-v16.18.0\node-v16.18.0-win-x64\node.exe
Date: 05/27/2024 17:04:33
Exception:
Notion Exception:
Websites: https://github.com/AminSallah/Flow.Launcher.Plugin.Notion
Author: Amin Salah
Version: 3.1.0
Flow.Launcher.Core.ExternalPlugins.FlowPluginException: Sequence contains no elements
---> System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.First[TSource](IEnumerable1 source) at Flow.Launcher.Plugin.Notion.Main.QueryAsync(Query query, CancellationToken token) at Flow.Launcher.Core.Plugin.PluginManager.<>c__DisplayClass23_0.<<QueryForPluginAsync>b__0>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 196 --- End of stack trace from previous location --- at Flow.Launcher.Infrastructure.Stopwatch.DebugAsync(String message, Func1 action) in C:\projects\flow-launcher\Flow.Launcher.Infrastructure\Stopwatch.cs:line 40
at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 230
--- End of inner exception stack trace ---
at Flow.Launcher.Core.Plugin.PluginManager.<>c__DisplayClass23_1.b__1(ActionContext _) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 224
at Flow.Launcher.ViewModel.MainViewModel.OpenResultAsync(String index) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 325
at CommunityToolkit.Mvvm.Input.AsyncRelayCommand.AwaitAndThrowIfFailed(Task executionTask)
at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
AminSallah commented 1 month ago

Hey @enoversum, this issue arose when the database didn't contain a url property. The newer version should resolve this issue.

enoversum commented 1 month ago

Hey @enoversum, this issue arose when the database didn't contain a url property. The newer version should resolve this issue.

Hi @AminSallah , thanks for getting back. Unfortunately, in the previous version, there was no hint why no database was selected or shown. Now the problem still persists, and once I start typing '@ [', your plugin informs me a URL property is missing. In fact, the database I want to pick indeed has a URL property. If I choose a different database, previously your plugin would auto-suggest database names, so even if I don't know the exact name, I could just type the first two letters and then pick it. Now I have to type the database name manually, and half the time it wouldn't accept my database name, even though the database is shared with your plugin. Furthermore, your plugin seems to be case-sensitive, so if the database name is 'Something', typing 'n @something Better' would create a page named 'something Better' instead of a page named 'Better' in my 'Something' database.

I also tried re-installing your plugin, to no avail, unfortunately! Thanks for your help already!

enoversum commented 3 weeks ago

Hey @AminSallah, sorry to disturb you. The issue still persists, I am afraid.

AminSallah commented 3 weeks ago

Hey @enoversum, thanks for the slight nudge. I tried to raise this issue on my case, but it looks like it works flawlessly, so without a detailed report or an error raised, I can't further investigate. Could you please follow these steps to refresh your cache manually:

  1. First, open the plugin directory from the little folder icon next to the delete icon in the plugin settings panel.
  2. Close Flow Launcher entirely through Task Manager or from the system tray icon.
  3. Locate a folder named cache. You should see at least three files: search.json and database.json. These files should never be empty and should be more than 1KB. Let me know if this is not the case.
  4. Delete all files inside the cache folder, but do not delete the cache folder itself.
  5. Navigate to the settings folder by clicking on FlowLauncher in the explorer address bar, then settings, then plugins, and delete the folder named Flow.Launcher.Plugin.Notion.
  6. Please note that any deletion should be done when Flow Launcher is entirely closed.
  7. Finally, start Flow Launcher and paste your token.

Also, nothing comes to mind about the problem unless it may be caused by the database name or properties names. If possible, create a new token for the plugin and share only a one database that doesn't contain symbols or non-English letters, because the plugin still suffers from these kinds of issues. Let's see if this works.

AminSallah commented 3 weeks ago

Also, before refreshing your cache, download v5 of the plugin. Navigate to artifacts at the bottom of the page and extract the DLL file, then replace it with the one in the plugin directory when Flow Launcher is closed. Then refresh your cache manually.

enoversum commented 3 weeks ago

Hey @AminSallah , thanks for taking care of me. This is what I did:

  1. Went into my user data folder and found out that I had several instances of your plugin (Notion-1.0, Notion 1.2.0, […], Notion-4.1.0) installed, although I didn't do this on purpose.
  2. Deleted all but the last, renamed it to Notion-5.0 and copied in your new dll file.
  3. Re-started Notion. Problem still occurs.
  4. Looked into your plugin's cache folder. Both files are non-zero sized (database.json: 30KB, search.json: 386KB). HiddenItems.txt is at 0KB, because I have no items I hid. I believe.
  5. Exited Flowlauncher and deleted all files inside the cache folder.
  6. Deleted settings for your plugin as per instructions above.
  7. Re-added my token (secret) to your plugin.
  8. Triggered my shortcut, your plugin claims I haven't shared any databases with the integration (it says 'Inegration' though).
  9. Tried re-loading plugin data, but still the same.

Unfortunately, going through your steps didn't help, but now the integration seems to be broken, too :D . I don't know if it helps or makes a difference, but I'm using the portable version of FlowLauncher. I believe it's just folders being in a different place though.

AminSallah commented 3 weeks ago

Hey Eno, This indicates that you were working with an old cache and your token can no longer access your databases. It may be that you moved your databases block to a non-shared page. Could you open a full database page and confirm whether your integration token is connected to this database or not? Let me know.

On Sun, Jun 23, 2024 at 4:12 PM Eno @.***> wrote:

Hey @AminSallah https://github.com/AminSallah , thanks for taking care of me. This is what I did:

  1. Went into my user data folder and found out that I had several instances of your plugin (Notion-1.0, Notion 1.2.0, […], Notion-4.1.0) installed, although I didn't do this on purpose.
  2. Deleted all but the last, renamed it to Notion-5.0 and copied in your new dll file.
  3. Re-started Notion. Problem still occurs.
  4. Looked into your plugin's cache folder. Both files are non-zero sized (database.json: 30KB, search.json: 386KB). HiddenItems.txt is at 0KB, because I have no items I hid. I believe.
  5. Exited Flowlauncher and deleted all files inside the cache folder.
  6. Deleted settings for your plugin as per instructions above.
  7. Re-added my token (secret) to your plugin.
  8. Triggered my shortcut, your plugin claims I haven't shared any databases with the integration (it says 'Inegration' though).
  9. Tried re-loading plugin data, but still the same.

Unfortunately, going through your steps didn't help, but now the integration seems to be broken, too :D . I don't know if it helps or makes a difference, but I'm using the portable version of FlowLauncher. I believe it's just folders being in a different place though.

— Reply to this email directly, view it on GitHub https://github.com/AminSallah/Flow.Launcher.Plugin.Notion/issues/11#issuecomment-2184983810, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5WZM5ULLE52VDAWC6VM4WTZI3CTHAVCNFSM6AAAAABILM2U66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUHE4DGOBRGA . You are receiving this because you were mentioned.Message ID: @.***>

enoversum commented 3 weeks ago

Hey Eno, This indicates that you were working with an old cache and your token can no longer access your databases. It may be that you moved your databases block to a non-shared page. Could you open a full database page and confirm whether your integration token is connected to this database or not? Let me know. … On Sun, Jun 23, 2024 at 4:12 PM Eno @.> wrote: Hey @AminSallah https://github.com/AminSallah , thanks for taking care of me. This is what I did: 1. Went into my user data folder and found out that I had several instances of your plugin (Notion-1.0, Notion 1.2.0, […], Notion-4.1.0) installed, although I didn't do this on purpose. 2. Deleted all but the last, renamed it to Notion-5.0 and copied in your new dll file. 3. Re-started Notion. Problem still occurs. 4. Looked into your plugin's cache folder. Both files are non-zero sized (database.json: 30KB, search.json: 386KB). HiddenItems.txt is at 0KB, because I have no items I hid. I believe. 5. Exited Flowlauncher and deleted all files inside the cache folder. 6. Deleted settings for your plugin as per instructions above. 7. Re-added my token (secret) to your plugin. 8. Triggered my shortcut, your plugin claims I haven't shared any databases with the integration (it says 'Inegration' though). 9. Tried re-loading plugin data, but still the same. Unfortunately, going through your steps didn't help, but now the integration seems to be broken, too :D . I don't know if it helps or makes a difference, but I'm using the portable version of FlowLauncher. I believe it's just folders being in a different place though. — Reply to this email directly, view it on GitHub <#11 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5WZM5ULLE52VDAWC6VM4WTZI3CTHAVCNFSM6AAAAABILM2U66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUHE4DGOBRGA . You are receiving this because you were mentioned.Message ID: @.>

Hi Amin, unfortunately, I triple-checked that the integration is (still) working and connected to relevant databases. I now even created a brand new integration, then completely un- and reinstalled your plugin, but either way, your plugin won't recognise my databases anymore. It claims the integration has no databases linked. Before I did the sweep, I could at least use and search through my content with your plugin :) .

AminSallah commented 2 weeks ago

I tried many scenarios with the plugin to replicate your issue, but the plugin passed all of them. Therefore, I recommend reverting to version 2.2. To do this, delete the current version and paste the following query into the FL search bar:

pm install https://github.com/AminSallah/Flow.Launcher.Plugin.Notion/releases/download/v2.2.0/Flow.Launcher.Plugin.Notion.zip

If version 2.2 works for you, it means the issue is caused by the new parser introduced in version 3 and latest versions. If it doesn't work, it means there is a scenario where the plugin can't handle your databases. In this case, please share your databases name, property types, names that are shared with the token and the FL log file for further investigation.

enoversum commented 2 weeks ago

I tried many scenarios with the plugin to replicate your issue, but the plugin passed all of them. Therefore, I recommend reverting to version 2.2. To do this, delete the current version and paste the following query into the FL search bar:

pm install https://github.com/AminSallah/Flow.Launcher.Plugin.Notion/releases/download/v2.2.0/Flow.Launcher.Plugin.Notion.zip

If version 2.2 works for you, it means the issue is caused by the new parser introduced in version 3 and latest versions. If it doesn't work, it means there is a scenario where the plugin can't handle your databases. In this case, please share your databases name, property types, names that are shared with the token and the FL log file for further investigation.

Hey @AminSallah , thanks for all the effort and your latest idea. I was about to do what you are suggesting, opened your plugin's settings. scrolled down and just, out of curiosity, opened the dropdown for the 'Default database' settings—and was able to pick one of them. This is weird: I remember I pasted the token, tried to pick a default database right afterwards (none were showing), tried your shortcut, but nothing came but the error message. Now, after several re-starts - or it might have been a combination of restarts and my re-installation incl. erasing settings - it seems to have picked up my token and databases. I tried the shortcut once again before I now picked a default database, same error message. So your plugin won't work without choosing my default database, as it stands.

So for now, it seems to work, strangely. I don't understand though why your plugin never shows under my installed plugins in the 'Download plugins' tab in Flow Launcher. Every other of my plugins does, your Notion plugin simply shows as if I hadn't installed it. I went through the normal installation routine through that store though.

enoversum commented 2 weeks ago

PS: I am able to pick databases again when creating a note with n @Mydatabase My note title. Still, I believe there was a dropdown with possible values for databases at some point, was there? And would you be able to make database names case insensitive for picking them? Meaning, when my database has the name My Database, could you enable picking the right database even if I spelled it my database (no capital letter)?