node-rfc icon indicating copy to clipboard operation
node-rfc copied to clipboard

Deployment on AWS Lambda

Open bsrdjan opened this issue 8 years ago • 11 comments

Following a question posted in #35, the node-rfc deployment on AWS Lambda requires SAP NW RFC libraries copied to location different from the the usual one, `/usr/local'.

The SAP NW RFC libs location must be configured for the operating system runtime, as described here and it must be configured in SAPNWRFC_HOME env variable, referenced in binding.gyp, for building from source.

Regarding operating system runtime, LD_LIBRARY_PATH env variable can be used, to add the library for the current session. For permanent change, a path should be added under /etc.ld.so.conf.d, like described in node-rfc documentation but that is probably not permitted on AWS Lambda?

Regarding building from source, is it required on AWS Lambda? You could eventually compile once and install that precompiled binary, together with SAP dependencies, added to LD_LIBRARY_PATH ?

Id build from source required, could a script eventually determine a current working directory and set SAPNWRFC_HOME accordingly? As far I could find in node-gyp documentation, node-gyp does not support relative paths.

bsrdjan avatar Dec 04 '17 10:12 bsrdjan

@bsrdjan , nope I don't have docker image to test AWS lambda in local. You can try AWS SAM.

PrakashSadasivam avatar Dec 04 '17 18:12 PrakashSadasivam

@PrakashSadasivam Here is a small example with a Dockerfile, and a minimal sample app with a package.json and an app.js that tests loading the module and shared lib: https://github.com/StefanScherer/node-rfc-docker

In the Dockerfile you can change SAPNWRFC_HOME to something else than /where/you/want/the/nwrfcsdk, the last directory name should be nwrfcsdk as it's part of the SAR file.

If there's a better way to enforce compilation of the binding during the npm install --production other than patching the /etc/hosts file I would be glad to improve that. But this example worked for me to show how to compile it inside a Docker container.

StefanScherer avatar Dec 04 '17 20:12 StefanScherer

npm install --build-from-source should help avoid /etc/hosts patching

bsrdjan avatar Dec 05 '17 09:12 bsrdjan

@PrakashSadasivam, I have no capacity atm for experimenting with deployment on AWS Lambda and hope hints above could help to start.

Can you share any more details on use-case here? SAP nwrfcsdk lib supports backend sessions and caches remote functions' modules metadata internally, to preserve them across repetitive calls, increasing the performance. Both features might be lost on serverless environment like AWS Lambda and if they do matter in your use case, another environment might be worth of considering? Although the node-rfc should technically work on AWS Lambda, serverless environment might not be always optimal choice for RFC protocol in general.

bsrdjan avatar Dec 05 '17 12:12 bsrdjan

Just a tip to others... I have successfully implemented a gRPC to rfc bridge. By using gRPC from AWS Lambda, it works great. No performance issues if we keep nwrfcsdk lib running in a daemon as a bridge.

heri16 avatar May 27 '18 16:05 heri16

@heri16 could you share the exact steps, please?

Suncatcher avatar Feb 25 '20 08:02 Suncatcher

Where the ABAP backend system should be installed, to be reached from AWS Lambda?

bsrdjan avatar Mar 02 '20 17:03 bsrdjan

Just a tip to others... I have successfully implemented a gRPC to rfc bridge. By using gRPC from AWS Lambda, it works great. No performance issues if we keep nwrfcsdk lib running in a daemon as a bridge.

Can you share more regarding this?

manishvyas1911 avatar May 20 '20 10:05 manishvyas1911

I created a demo on how to use node-rfc on AWS Lambda with NWRFCSDK https://www.youtube.com/watch?v=rhY4jVtl0k8&t=39s It may help. Thanks!

manishvyas1911 avatar Jun 09 '20 14:06 manishvyas1911

The feature request to enable SAP NWRFC SDK usage on AWS Lambda, in Connectivity context, can be created for:

Security Services category of the SAP Cloud Platform – Platform Foundation

bsrdjan avatar Nov 03 '20 12:11 bsrdjan

You may vote for the new request, linked here: https://github.com/SAP/node-rfc/issues/145#issuecomment-781209573

bsrdjan avatar Feb 18 '21 14:02 bsrdjan