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

"ep_openid_connect" plugin work with v2.0.x? #6330

Open
vladimirdulov opened this issue Apr 15, 2024 · 15 comments · May be fixed by #6396
Open

"ep_openid_connect" plugin work with v2.0.x? #6330

vladimirdulov opened this issue Apr 15, 2024 · 15 comments · May be fixed by #6396

Comments

@vladimirdulov
Copy link

Could you advise if the suggested plugin "ep_openid_connect" is still working with v2.0.x?
I get the following error in the etherpad-lite log, openid connect plugin doesn't seem to work.

[2024-04-15T15:47:24.461] [ERROR] settings - Failed to load hook function "/run/etherpad-lite/src/plugin_packages/ep_openid_connect:authenticate" for plugin "ep_openid_connect" part "main" hook set "hooks" hook "authenticate": TypeError: LRU is not a constructor
    at Object.<anonymous> (/app/code/src/plugin_packages/openid-client/lib/helpers/request.js:62:16)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Object.S (/run/etherpad-lite/node_modules/.pnpm/tsx@4.7.2/node_modules/tsx/dist/cjs/index.cjs:1:1292)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/app/code/src/plugin_packages/openid-client/lib/client.js:25:17)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Object.S (/run/etherpad-lite/node_modules/.pnpm/tsx@4.7.2/node_modules/tsx/dist/cjs/index.cjs:1:1292)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/app/code/src/plugin_packages/openid-client/lib/issuer.js:5:19)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)

Ethepad-lite version: 2.0.2 (it seems all 2.0.x affected)

@SamTV12345
Copy link
Member

It is fixed in ep_openid_connect v3.0.7

@yacchin1205
Copy link

yacchin1205 commented Apr 17, 2024

@SamTV12345 Thanks for the fix!

I faced the same error too, I have upgraded ep_openid_connect to 3.0.7, but I still seemed to be getting the same error.

therpad-1  | [2024-04-17T01:49:33.464] [ERROR] settings - Failed to load hook function "/opt/etherpad-lite/src/plugin_packages/ep_openid_connect:authenticate" for plugin "ep_openid_connect" part "main" hook set "hooks" hook "authenticate": TypeError: LRU is not a constructor
etherpad-1  |     at Object.<anonymous> (/opt/etherpad-lite/src/plugin_packages/openid-client/lib/helpers/request.js:62:16)
etherpad-1  |     at Module._compile (node:internal/modules/cjs/loader:1368:14)
etherpad-1  |     at Object.S (/opt/etherpad-lite/node_modules/.pnpm/tsx@4.7.2/node_modules/tsx/dist/cjs/index.cjs:1:1292)
etherpad-1  |     at Module.load (node:internal/modules/cjs/loader:1205:32)
etherpad-1  |     at Module._load (node:internal/modules/cjs/loader:1021:12)
etherpad-1  |     at Module.require (node:internal/modules/cjs/loader:1230:19)
etherpad-1  |     at require (node:internal/modules/helpers:179:18)
etherpad-1  |     at Object.<anonymous> (/opt/etherpad-lite/src/plugin_packages/openid-client/lib/client.js:25:17)
etherpad-1  |     at Module._compile (node:internal/modules/cjs/loader:1368:14)
etherpad-1  |     at Object.S (/opt/etherpad-lite/node_modules/.pnpm/tsx@4.7.2/node_modules/tsx/dist/cjs/index.cjs:1:1292)
etherpad-1  |     at Module.load (node:internal/modules/cjs/loader:1205:32)
etherpad-1  |     at Module._load (node:internal/modules/cjs/loader:1021:12)
etherpad-1  |     at Module.require (node:internal/modules/cjs/loader:1230:19)
etherpad-1  |     at require (node:internal/modules/helpers:179:18)
etherpad-1  |     at Object.<anonymous> (/opt/etherpad-lite/src/plugin_packages/openid-client/lib/issuer.js:5:19)
etherpad-1  |     at Module._compile (node:internal/modules/cjs/loader:1368:14)

I am running etherpad with docker. And I checked the installed packages and the following appears to be happening:

  • The version of ep_openid_connect (/opt/etherpad-lite/src/plugin_packages/ep_openid_connect/package.json) is 3.0.7 correctly.
  • The version of lru-cache in plugin_packages (/opt/etherpad-lite/src/plugin_packages/lru-cache/package.json) is 6.0.0 (ep_openid_connect depends on openid-client, which depends on lru-cache@^6.0.0.)
  • However, the version of lru-cache in node_modules (/opt/etherpad-lite/src/node_modules/lru-cache/package.json) is 10.2.0.

I found out that etherpad-lite requires lru-cache@^10.2.0 ( code ). Therefore, the version of lru-cache referenced by openid-client seems to be unexpectedly newer and is failing.

Could Etherpad's plugin mechanism of 2.0.x not work properly if there are version conflicts in the packages it depends on?

@SamTV12345
Copy link
Member

@SamTV12345 Thanks for the fix!

I faced the same error too, I have upgraded ep_openid_connect to 3.0.7, but I still seemed to be getting the same error.

therpad-1  | [2024-04-17T01:49:33.464] [ERROR] settings - Failed to load hook function "/opt/etherpad-lite/src/plugin_packages/ep_openid_connect:authenticate" for plugin "ep_openid_connect" part "main" hook set "hooks" hook "authenticate": TypeError: LRU is not a constructor
etherpad-1  |     at Object.<anonymous> (/opt/etherpad-lite/src/plugin_packages/openid-client/lib/helpers/request.js:62:16)
etherpad-1  |     at Module._compile (node:internal/modules/cjs/loader:1368:14)
etherpad-1  |     at Object.S (/opt/etherpad-lite/node_modules/.pnpm/tsx@4.7.2/node_modules/tsx/dist/cjs/index.cjs:1:1292)
etherpad-1  |     at Module.load (node:internal/modules/cjs/loader:1205:32)
etherpad-1  |     at Module._load (node:internal/modules/cjs/loader:1021:12)
etherpad-1  |     at Module.require (node:internal/modules/cjs/loader:1230:19)
etherpad-1  |     at require (node:internal/modules/helpers:179:18)
etherpad-1  |     at Object.<anonymous> (/opt/etherpad-lite/src/plugin_packages/openid-client/lib/client.js:25:17)
etherpad-1  |     at Module._compile (node:internal/modules/cjs/loader:1368:14)
etherpad-1  |     at Object.S (/opt/etherpad-lite/node_modules/.pnpm/tsx@4.7.2/node_modules/tsx/dist/cjs/index.cjs:1:1292)
etherpad-1  |     at Module.load (node:internal/modules/cjs/loader:1205:32)
etherpad-1  |     at Module._load (node:internal/modules/cjs/loader:1021:12)
etherpad-1  |     at Module.require (node:internal/modules/cjs/loader:1230:19)
etherpad-1  |     at require (node:internal/modules/helpers:179:18)
etherpad-1  |     at Object.<anonymous> (/opt/etherpad-lite/src/plugin_packages/openid-client/lib/issuer.js:5:19)
etherpad-1  |     at Module._compile (node:internal/modules/cjs/loader:1368:14)

I am running etherpad with docker. And I checked the installed packages and the following appears to be happening:

  • The version of ep_openid_connect (/opt/etherpad-lite/src/plugin_packages/ep_openid_connect/package.json) is 3.0.7 correctly.
  • The version of lru-cache in plugin_packages (/opt/etherpad-lite/src/plugin_packages/lru-cache/package.json) is 6.0.0 (ep_openid_connect depends on openid-client, which depends on lru-cache@^6.0.0.)
  • However, the version of lru-cache in node_modules (/opt/etherpad-lite/src/node_modules/lru-cache/package.json) is 10.2.0.

I found out that etherpad-lite requires lru-cache@^10.2.0 ( code ). Therefore, the version of lru-cache referenced by openid-client seems to be unexpectedly newer and is failing.

Could Etherpad's plugin mechanism of 2.0.x not work properly if there are version conflicts in the packages it depends on?

Oh that is a bummer. It's the client. I opened a pr over there that bumps the LRU cache to version 10. Then I can do a final update of the openid-client and it should work again panva/node-openid-client#674

@yacchin1205
Copy link

Oh that is a bummer. It's the client. I opened a pr over there that bumps the LRU cache to version 10. Then I can do a final update of the openid-client and it should work again panva/node-openid-client#674

Thank you for making the Pull Request on node-openid-client.
(Unfortunately, the pull request was closed without being merged...)

Such version conflicts seem to occur in several other npm packages. (For example, in my plugin ep_kodama, openai-node seemed to contain such a conflict. yacchin1205/ep_kodama#1 )
I assume npm allows for such conflicts https://stackoverflow.com/questions/42147243/how-does-npm-handle-version-conflicts . So I think that Etherpad's plugin mechanism should also allow for such conflicts so that it can accept a wide variety of plugins ☺️

@SamTV12345
Copy link
Member

Oh that is a bummer. It's the client. I opened a pr over there that bumps the LRU cache to version 10. Then I can do a final update of the openid-client and it should work again panva/node-openid-client#674

Thank you for making the Pull Request on node-openid-client. (Unfortunately, the pull request was closed without being merged...)

Such version conflicts seem to occur in several other npm packages. (For example, in my plugin ep_kodama, openai-node seemed to contain such a conflict. yacchin1205/ep_kodama#1 ) I assume npm allows for such conflicts https://stackoverflow.com/questions/42147243/how-does-npm-handle-version-conflicts . So I think that Etherpad's plugin mechanism should also allow for such conflicts so that it can accept a wide variety of plugins ☺️

I agree we need to find a more sophisticated way to store plugins. The question is only how. If you can think about a solution for this problem that would be great. I haven't found a solution on how to tell node that there is an alternative path in plugin_packages for that

@yacchin1205
Copy link

yacchin1205 commented Apr 27, 2024

I agree we need to find a more sophisticated way to store plugins. The question is only how. If you can think about a solution for this problem that would be great. I haven't found a solution on how to tell node that there is an alternative path in plugin_packages for that

Thanks for the reply. I will try to improve this behavior.
I checked the code and it seems that the live-plugin-manager used by etherpad-lite also recognizes this as a known issue, and it says "Plugin dependencies can be specified only as NPM dependencies (version number) or github dependencies (owner/repo), url or other kind of dependencies are not supported". (Issue davideicardi/live-plugin-manager#3 still exists)
So I will consider including suggestions for improvements to live-plugin-manager.

@TaliZorahVasNormandy
Copy link

Is there any news on a fix for this error?

@SamTV12345
Copy link
Member

I just published the fix. Now I noticed that the node-live-plugin manger has some issues with other registries as I published the patched version of openid-client on jsr https://jsr.io/@etherpad/node-openid-client/publish . I'll try to come up with a solution tomorrow.

@TaliZorahVasNormandy
Copy link

Oh wow thank you so much!! Etherpad was the last bit of infrastructure I wanted to include in my SSO network and tuesday the first users are coming in, hugely appreciate your work!!!

@yacchin1205
Copy link

(Issue davideicardi/live-plugin-manager#3 still exists) So I will consider including suggestions for improvements to live-plugin-manager.

FYI I am preparing code for improvements to live-plugin-manager. (Branch https://github.com/yacchin1205/live-plugin-manager/tree/feature/version-management )
I would like to test and submit a Pull Request in the next few days.

@yacchin1205
Copy link

I have submitted a Pull Request for live-plugin-manager. If merged, using the modified live-plugin-manager and making minor fixes to etherpad-lite should resolve this issue.

@yacchin1205
Copy link

The pull request for live-plugin-manager has been merged, and I will submit a pull request here when new version of the live-plugin-manager is published!

@SamTV12345
Copy link
Member

The pull request for live-plugin-manager has been merged, and I will submit a pull request here when new version of the live-plugin-manager is published!

Awesome did you ask him for a new release :) ?

@yacchin1205
Copy link

Awesome did you ask him for a new release :) ?

Yes 😄 It may be released in the near future.

@yacchin1205
Copy link

yacchin1205 commented May 21, 2024

Now that the new version of live-plugin-manager has been released! I am working on a revised version and testing it. I believe the Pull Request will be available in the next few days.

https://github.com/yacchin1205/etherpad-lite/tree/feature/upgrade-live-plugin-manager-1.0.0

@yacchin1205 yacchin1205 linked a pull request May 21, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants