unity-sds / unity-cs

Unity Common Services
Apache License 2.0
0 stars 2 forks source link

Investigate npm/nodeJS MCP restrictions #130

Closed galenatjpl closed 1 year ago

galenatjpl commented 1 year ago

Can't pull in certain libraries (needed for #129)

galenatjpl commented 1 year ago

@ramesh-maddegoda Do you have an example of the error message, or notification of restriction here?

mike-gangl commented 1 year ago

this seems odd, how does the AMI prevent the inclusion of libraries? is it a known vulnerability in the package?

ramesh-maddegoda commented 1 year ago

@galenatjpl and @mike-gangl ,

I have to make a correction. It was not python libraries. It was npm/nodejs.

I am using the MCP Ubuntu ARM64 18.04 20220801T230742 and trying to setup a JupyterHub environment to develop a custom authenticator to capture and pass auth tokens from JupyterHub to Jupyter Lab.

I am following the installation guide at https://jupyterhub.readthedocs.io/en/stable/quickstart.html and the following command worked well previously in MCP with Ubuntu instances. It seems it fails to upgrade npm now telling "nodejs is already the newest version (8.10.0~dfsg-2ubuntu0.4)". But the command npm install -g configurable-http-proxy is looking for a newer node version. (I followed the instructions in https://github.com/nodesource/distributions#installation-instructions too)

ssm-user@ip-10-52-10-141:~$ sudo apt-get install nodejs npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
npm is already the newest version (3.5.2-0ubuntu4).
**nodejs is already the newest version (8.10.0~dfsg-2ubuntu0.4).**
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

ssm-user@ip-10-52-10-141:~$ npm install -g configurable-http-proxy
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine configurable-http-proxy@4.5.3: wanted: {"node":">= 10.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Linux 5.4.0-1080-aws
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "configurable-http-proxy"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>
WARN engine prom-client@14.1.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
**WARN engine winston@3.8.2: wanted: {"node":">= 12.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})**

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ssm-user/npm-debug.log
ssm-user@ip-10-52-10-141:~$
galenatjpl commented 1 year ago

Does running this fix it? npm install -g npm@latest

ramesh-maddegoda commented 1 year ago

@galenatjpl , that also fails with the following error. I will create a ticket for this.

sm-user@ip-10-52-10-153:~$ sudo npm install -g npm@latest
▀ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine npm@9.1.1: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm WARN install:@colors/colors@1.5.0 ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@colors/colors-c8990a6d' -> '/usr/local/lib/node_modules/npm/node_modules/@col
ors/colors'
/usr/local/lib
└── (empty)

npm ERR! Linux 5.4.0-1080-aws
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "npm@latest"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35a
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35a' -> '/usr/local/lib/node_modules/npm/node_modules/@gar/promisify'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35a' -> '/usr/local/lib/node_modules/npm/node_modules/@gar/promisify'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ssm-user/npm-debug.log
npm ERR! code 1
ramesh-maddegoda commented 1 year ago

I created the MCP Service Desk ticket: https://jaas.gsfc.nasa.gov/servicedesk/customer/portal/2/GSD-1635

galenatjpl commented 1 year ago

@ramesh-maddegoda , on Dec 2nd, Gabriel states this:

" Ramesh Maddegoda The issue is the version of node available via the Ubuntu repos is v8x. In order to use a newer version of node you will either need to install it manually or maybe try a newer version of Ubuntu. We have a CSET compliant Ubuntu v20.04 available, but ARM may not be available yet. That should be coming with the new year.

This is not an issue I can solve for you as its an issue with that version of Ubuntu and its available node versions. I found a bunch of articles via Google for manually installing a newer version of node on Ubuntu 18.04. "

I'm not entirely following what the differences are between when it was working, and now. So: 1) Are there any more updates on this? 2) Is this still blocking https://github.com/unity-sds/unity-cs/issues/129 ? It seems like "no", since I think you had some working prototype of the recently.

ramesh-maddegoda commented 1 year ago

@ramesh-maddegoda , on Dec 2nd, Gabriel states this:

" Ramesh Maddegoda The issue is the version of node available via the Ubuntu repos is v8x. In order to use a newer version of node you will either need to install it manually or maybe try a newer version of Ubuntu. We have a CSET compliant Ubuntu v20.04 available, but ARM may not be available yet. That should be coming with the new year.

This is not an issue I can solve for you as its an issue with that version of Ubuntu and its available node versions. I found a bunch of articles via Google for manually installing a newer version of node on Ubuntu 18.04. "

I'm not entirely following what the differences are between when it was working, and now. So:

  1. Are there any more updates on this?
  2. Is this still blocking Implement an approach to pass Cognito tokens from JupyterHub to JupyterLab #129 ? It seems like "no", since I think you had some working prototype of the recently.

@galenatjpl, this is not blocking #129 anymore. Because I was able to develop it locally. About nodeJS issue: We do not have to setup a development environment on AWS EC2 anymore for this, since the local development environment was suitable. We can work with James M. etc. to integrate the changes done with #129 to their scripts (terraform) which are used to deploy JupyterHub on MCP.

galenatjpl commented 1 year ago

@ramesh-maddegoda awesome. So it seems this can be closed, or marked as "not an issue anymore"?

ramesh-maddegoda commented 1 year ago

@galenatjpl , I closed it.