Trying SFTP Connection via API Proxy on APIGEE Edge

Not applicable

Hi,

Can someone help if they have created an API Proxy to establish sftp connection on Public Cloud?

I tried creating API Proxy using node script target and used couple of npm sftp modules (ssh2-sftp-client, ssh2 etc.) but without any success. I got the below error:

{fault:{faultstring:"Script node executed prematurely: Error: Cannot find module 'ssh2'\nError: Cannot find module 'ssh2'\n at module.js:340:0\n at module.js:280:0\n at module.js:364:0\n at require (module.js:380:0)\n at \/organization\/environment\/api\/hello-world.js:1:0\n at module.js:456:0\n

Though I have imported the module using management API.

If anyone has implemented SFTP connection successfully either via npm or Java callout on APIGEE Edge, could you please shed some light on it?

Thanks,

Sanchi

0 3 1,113
3 REPLIES 3

Not applicable

@Maruti Chand, @Anil Sagar , could you please help?

Yes, SFTP has been implemented successfully

https://community.apigee.com/questions/52148/trying-a-sftp-connection-via-java-callout.html

But you are trying to do it in nodejs and you seem to be missing required module dependencies. Here is what i'd recommend:

- Develop your node application outside Apigee and make it work. (Developing a nodejs app inside apigee edge ui will slow you down). Stick to ES5 syntax

- Once your application works outside apigee, create the Apigee required project structure on your local machine (Basically, put your whole application inside resources/node directory) and adhere to the requirements of apigee node plugin

- Use the plugin to deploy your proxy with the node target . In the deployment process you must choose one of --resolve-modules or --upload-modules

For a difference among them, please refer https://github.com/apigee/apigeetool-node#deploynodeapp

Thanks @rmishra for your reply.

Let me try the solution suggested by you for establisihing SFTP connection.