alebcay / openlens-node-pod-menu

Node and pod menus for OpenLens
https://www.npmjs.com/package/@alebcay/openlens-node-pod-menu
MIT License
828 stars 46 forks source link

Menu items not available after enabling #40

Open pmbsa opened 1 year ago

pmbsa commented 1 year ago

Hi, thank you for this addon, I was wondering if anybody has seen an issue where the addon is installed and enabled but we get no additional options for pod logs etc, only the default openlens options?

I had to install it via the tar download, no direct access to github but it installed fine and enabled fine.

thanks Paul

pmbsa commented 1 year ago

I believe its probably down to the restricted internet access again. Fro developer view I can see the error below, looks like it needs to get out to download some stuff and I dont think it can. I have configured OL to use our proxy but the settings dont cater for requiring authentication so I suspect its failing

BrowserConsole.js:47 [EXTENSIONS-LOADER]: can't load renderer for "@alebcay/openlens-node-pod-menu": Error: Cannot find module 'C:\Users\8798238\AppData\Roaming\OpenLens\node_modules\@alebcay\openlens-node-pod-menu\dist\renderer.js'
Require stack:
- electron/js2c/renderer_init
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at i._resolveFilename (node:electron/js2c/renderer_init:33:1095)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at i._load (node:electron/js2c/renderer_init:33:356)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at ExtensionLoader.requireExtension (https://1f3515d….lens.app:59766/build/lens.js?5a1bf22…:542270:20)
    at https://1f3515d….lens.app:59766/build/lens.js?5a1bf22…:542222:53
    at Array.map (<anonymous>) 
alexeyatbluescape commented 1 year ago

Happened here, the same exception. But after a hard refresh (cmd+R) started working again 🤷.

slavong commented 1 year ago

The same here, OpenLens 6.4.15, behind proxy, had to install using TGZ file. The same error as above, hard refresh did not help.

brpaz commented 1 year ago

I got the same problem. In my case, it seems to be that OpenLens is looking for the extension code in a different place, than where the extension was installed, from OpenLens GUI.

Installed: ~/.var/app/dev.k8slens.OpenLens/.k8slens/extensions/alebcay--openlens-node-pod-menu

Expected: ~/.var/app/dev.k8slens.OpenLens/config/OpenLens/node_modules/@alebcay

By copying the files to the expected folder, it started working.

UmarFKhawaja commented 1 year ago

Thank you very much @brpaz, that helped me solve this same issue. Here's how I solved it for myself using @brpaz's advice.

I opened up Dev Tools in OpenLens to check what error was being thrown.

I saw that it was failing to find the plugin NPM package files in the location, which in my case was $HOME/.config/OpenLens/node_modules since I am on Ubuntu 23.04.

So I opened up a bash prompt at $HOME/.config/OpenLens and ran the following command:

npm install @alebcay/openlens-node-pod-menu

That fixed the issue and now I have the long-missing Pod menu in OpenLens.

alebcay commented 1 year ago

Thanks everyone for the info. Can someone please open an issue upstream for this? From what has been presented so far, this looks like an issue with the extension loading and installation process within Lens itself (this extension does not, for instance, dictate the npm command listed above as a workaround, or control the path into which it is installed).

Upstream may also ask for other information in the issue description, hence why I would appreciate if someone who has run into the issue to report there; I have not been able to reproduce this locally and am missing parts of what they're asking for.

mfriess2 commented 1 year ago

We had the same problem. This worked for us under MacOS:

ln -s ~/.k8slens/extensions/alebcay--openlens-node-pod-menu ~/Library/Application\ Support/OpenLens/node_modules/\@alebcay/openlens-node-pod-menu


* Start OpenLens again
* Enable the extension if necessary
Awot83 commented 1 year ago

same problem here, installed on windows :

debug :

BrowserConsole.js:47 [EXTENSIONS-LOADER]: can't load renderer for "@alebcay/openlens-node-pod-menu": Error: Cannot find module 'C:\Users\xxxxxxxx\AppData\Roaming\OpenLens\node_modules\@alebcay\openlens-node-pod-menu\dist\renderer.js'
Require stack:
- electron/js2c/renderer_init
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at i._resolveFilename (node:electron/js2c/renderer_init:33:1095)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at i._load (node:electron/js2c/renderer_init:33:356)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at ExtensionLoader.requireExtension (https://0db381312a321e2d62459b2eb7f4dbee.lens.app:37052/build/OpenLens.js?d8e99657584b2f5b7773:488590:20)
    at https://0db381312a321e2d62459b2eb7f4dbee.lens.app:37052/build/OpenLens.js?d8e99657584b2f5b7773:488542:53
    at Array.map (<anonymous>) {extension: {…}}

so i tried to find a renderer.js file in the .tar but there is not this file there is the file renderer.tsx i renamed .js and put in a dist directory i created : C:\Users\xxxxxxxx\AppData\Roaming\OpenLens\node_modules\@alebcay\openlens-node-pod-menu\dist\ but it didn't work

why is there no "renderer.js" file while the logs request it ?

alebcay commented 1 year ago

It sounds like you are trying to download/use the source files from this repository, which is uncompiled TypeScript. The build process converts this into plain JavaScript which OpenLens consumes as a plugin.

You can see that the version pushed to npm contains the renderer.js:

$ curl "https://registry.npmjs.org/@alebcay/openlens-node-pod-menu/-/openlens-node-pod-menu-0.1.2.tgz" | tar tzf -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4456  100  4456    0     0   9958      0 --:--:-- --:--:-- --:--:-- 10104
package/LICENSE
package/dist/renderer.js
package/package.json
package/README.md

Installing by providing the package name to OpenLens should from npmjs and thus contain the expected files.

Awot83 commented 1 year ago

thanks, it works perfectly now with the tgz you send

kuschuermann commented 1 year ago

Success: Installation works perfectly (for me on a Mac) if I install using "@albecay/openlens-node-pod-menu"

If instead I give the URL to the .tgz or select the downloaded .tgz in the file system, OpenLens claims that the installation was successful, but the Status flickers rapidly(!) back and forth between Enabled/Disabled until I restart OpenLens. After restarting, the Status is then steady (Enabled), but the menus still do not show up, and none of the solutions shown above make any difference. Attempting to uninstall did not remove the extension, and I had to edit various json files to truly uninstall the extension before I could install using the '@'-reference.

I hope this helps someone :)

altsgamer commented 1 year ago

I had same issue: windows without github acces and OpenLens 6.5.2-366 without logs button.

I was download https://github.com/alebcay/openlens-node-pod-menu/archive/refs/tags/v0.1.2.tar.gz, unpack it and install from Extention page. Nothing was change :) Than I was download https://registry.npmjs.org/@alebcay/openlens-node-pod-menu/-/openlens-node-pod-menu-0.1.2.tgz and copy "dist" folder from it in c:\Users\%USER%\AppData\Roaming\OpenLens\node_modules\alebcay\openlens-node-pod-menu

Restart OpenLens - and works!

marafa-sugarcrm commented 1 year ago

uninstall and then reinstalling fixed this for me

rakker91 commented 1 year ago

On Windows: For me, it looks like it was creating either a symbolic link or a shortcut. When I recreated the folder and copied the contents over, it started working. Here's what my folder looked like: image The second folder is the "original". The one with the correct name is the one I created manually.

Dunge commented 12 months ago

On Windows doesn't seem to work here. The extensions were "installed" and green, but no button. I went into c:\Users\%USER%\AppData\Roaming\OpenLens\node_modules\ and followed @rakker91 advice of renaming the shortcut, creating a folder and copying files into it, then deleting the shortcut, and now I open lens and the extension menu is empty.

This could definitely be improved.