Closed steve-king-ky closed 4 years ago
Did you check prerequisites on IIS: https://github.com/SAP/node-rfc#prerequisites ?
Also if SAP NWRFC SDK is correctly installed, by running rfcexc.exe
: http://sap.github.io/node-rfc/install.html#test ?
@bsrdjan Yes, it appears to have been installed correctly. If I execute a script from the command-line that uses node-rfc it works perfect. This error only happens when executing under IIS for some reason.
Could it be that IIS for some reason can't access the SAP NNRFC SDK path?
To verify, I would try something like this on IIS:
// verify the IIS user
console.log(os.userInfo());
/*
{
uid: 501,
gid: 20,
username: 'bsrdjan',
homedir: '/Users/bsrdjan',
shell: '/usr/local/bin/zsh'
}
*/
// verify SAP NWRFC SDK is on PATH
console.log(process.env.PATH)
// verify IIS can read SAP NWRFC SDK libs
// do some readfile from SAP NWRFC SDK lib here ...
Great idea and running it led to an unusual discovery. The user has access but the value returned by process.env.PATH does NOT contain the path to nwrfcsdk - even though it's in the PATH environment variable (Windows) on both the system and the user.
Even more odd, if I run node.exe and run the following code:
process.env.PATH
I do see the path to the SDK listed. I restarted the IIS server but it still won't pull back the correct path. I'm not sure where it's pulling it from or if it's perhaps truncating the path?
Web servers restrict web sites' to local host paths. IIS could be configured the same way, using virtual directories etc. Perhaps this helps: https://stackoverflow.com/questions/14611015/iis7-accessing-network-share
@bsrdjan I am running in the same problem. I downloaded windows x64 binary from here https://github.com/SAP/node-rfc/releases/tag/v1.2.0, and I'm getting the same error:
Error: The specified module could not be found.
Also if SAP NWRFC SDK is correctly installed, by running rfcexc.exe: http://sap.github.io/node-rfc/install.html#test ?
Also checked this. It is correctly installed.
This is from a simple .js file that imports node-rfc:
const rfc = require("node-rfc")
I logged process.env.PATH, and the SAP NWRFC SDK path gets listed.
Any idea why this might happen?
Thanks.
As far as I can tell, it’s a versioning issue. I was able to get node-rfc to work with v12.18.0 (the latest version of node when I downloaded it recently) and node-rfc v. 1.0.0.
I am running in the same problem. I downloaded windows x64 binary from here https://github.com/SAP/node-rfc/releases/tag/v1.2.0https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_SAP_node-2Drfc_releases_tag_v1.2.0&d=DwMCaQ&c=jvUANN7rYqzaQJvTqI-69lgi41yDEZ3CXTgIEaHlx7c&r=0cnh2ele5QovaKlZoZ8ilgyH2T2Y09GAxa8EnMZKmP8&m=C08JkxWU62UoShF5k1xAIODy0pqtNZxZ4qJK947fE0Y&s=0MyxZa8ST99tXlbsQ4EXx5fY4ME4-7C4BDEjOP_0cv0&e=, and I'm getting the same error:
Error: The specified module could not be found.
This is from a simple .js file that imports node-rfc: const rfc = require("node-rfc")
I logged process.env.PATH, and the SAP NWRFC SDK path gets listed.
Any idea why this might happen?
Sorry for the longer waiting here. I don't see a difference in node-rfc version, causing the issue.
Could it be the authorisation problem? Could it be that IIS is running with another user account, which does not have access to NWRFC SDK ?
No worries - thank you so much for your interest in this post, by the way. I do not think that was the issue. Once I paired version 1.0.0 of the node-rfc packge with the latest version of node.js it worked fine.
Thanks for the update, let close the issue then. I also sent one message via LinkedIn.
Today a test server was setup and I moved a project I'm working there. It's a Node application using Express. When I tested an endpoint it failed with:
However, when I go to the command-line and run the same code that connects to SAP via node-rfc in a small .js file using it works just fine so there's something about the context of it running under IIS that's causing the issue although I've no idea.
BTW, the line:
const rfc = require("node-rfc")
when running in a script under IIS, is enough to cause the program to crash.Any suggestions? This is driving me crazy...