Error calling npm install on the management api

Not applicable

Hi,

I'm running an Apigee on premise instance (version 4.15.07.00) and for the proxies using Node scripts I want to install the dependencies via the management API. Unfortunately it ends up in error and I'm hoping someone has come across the same issue or has an idea how to solve it.

The call I'm using looks like this:

curl -ikX POST -H "Content-Type: application/x-www-form-urlencoded" -d "command=install" "https://[apigee_host]/v1/organizations/[org]/apis/[proxy_name]/revisions/1/npm" -u [user]:[pass]

which results in an exception while fetching the node modules (taken from the management-server system.log):

ERROR REST - ExceptionMapper.toResponse() : Error occurred : JavaScript execution failed: java.util.concurrent.ExecutionException: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@6fccd087 rejected from java.util.concurrent.ThreadPoolExecutor@6ef74dc2[Running, pool size = 1000, active threads = 5, queued tasks = 8, completed tasks = 1410988] com.apigee.gateway.services.nodescript.dependency.DependencyAPI.runNpm(DependencyAPI.java:418) com.apigee.gateway.services.nodescript.dependency.DependencyAPI.updateDependenciesInternal(DependencyAPI.java:208) com.apigee.gateway.services.nodescript.dependency.DependencyAPI.updateDependenciesForm(DependencyAPI.java:181) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173) com.apigee.rest.framework.CustomJAXRSInvoker.performInvocation(CustomJAXRSInvoker.java:125)

In the npm-debug log for the corresponding transaction this is the error that I get:

11775 silly gunzTarPerm extractEntry LICENSE 11776 silly gunzTarPerm extractEntry package.json 11777 silly gunzTarPerm extractEntry package.json 11778 silly gunzTarPerm extractEntry package.json 11779 error Bad length: expected 0 and actually read 40960 11780 error If you need help, you may report this *entire* log, 11780 error including the npm and node versions, at: 11780 error <http://github.com/npm/npm/issues> 11781 error System Trireme Trireme 11782 error command "./node" "/opt/apigee4/share/apigee/lib/node_modules/npm/cli.js" "--loglevel" "error" "--registry" "https://repo.swisscom.com/mvn/content/groups/npm-all" "--cache" "/opt/apigee4/var/log/apigee/management-server/work/npm-cache" "--ignore-scripts" "true" "--bin-links" "false" "--json" "install" 11783 error cwd /opt/apigee4/var/log/apigee/management-server/work/npm/npm4195967824237798480.tmp 11784 error node -v v0.10.32 11785 error npm -v 1.4.3 11786 verbose exit [ 1, true ]

Thanks in advance,

Mihai

0 1 486
1 REPLY 1

Not a solution, but a workaround. You can use apigeetool to push the complete proxy including modules: https://www.npmjs.com/package/apigeetool