SAP / node-rfc

Asynchronous, non-blocking SAP NW RFC SDK bindings for Node.js
Apache License 2.0
249 stars 73 forks source link

Parameter not found #228

Closed iamNoah1 closed 2 years ago

iamNoah1 commented 2 years ago

Describe the bug Even though I have a sapnwrfc.ini in my working directory and the dev_rfc.log says that it found the config file, when I run my code it says: Parameter ASHOST, GWHOST, MSHOST or PORT is missing

To Reproduce Follow installation steps for windows. Create nodejs project. Use the following index.js:

const noderfc = require("node-rfc");

const pool = new noderfc.Pool({ connectionParameters: { dest: "MME" } });

(async () => {
    try {
        const client = await pool.acquire();
        console.log(result);
    } catch (err) {
        console.error(err);
    }
})();

Environment

undefined

bsrdjan commented 2 years ago

Could you please share the content of sapnwrfc.ini ?

The same error message is raised when the MME destination is not maintained in the INI file or when the file is corrupted, or when one of parameters is indeed missing.

iamNoah1 commented 2 years ago

sure:

DEST="MME"
ASHOST="172.17.33.56"
USER=redacted
PASSWD="redacted"
SYSNR=00
CLIENT=360
LANG=EN
TRACE=3
SAPROUTER="172.17.60.151"

I tried with and without quotes.

How can I exclude that the file is corrupt?

bsrdjan commented 2 years ago

Quotes are not used in sapnwrfc.ini, try with all of them removed:

DEST=MME
ASHOST=172.17.33.56
USER=redacted
PASSWD=redacted
SYSNR=00
CLIENT=360
LANG=EN
TRACE=3
SAPROUTER=172.17.60.151
iamNoah1 commented 2 years ago

That is what I tried initially before trying to add quotes. Same error message.

bsrdjan commented 2 years ago

Could you please post all steps from new work directory creation to node-rfc installation, like:

mkdir workdir
cd workdir
npm init -y
npm i node-rfc

At this point the output of node -p "require('node-rfc').environment" should return the environment info, must not be undefined.

Then create sapnwrfc.ini in workdir and re-test.

iamNoah1 commented 2 years ago

I have no clue why but somehow my initial project directory was corrupted. I set up everything from scratch with the commands you provided and now at least I don't get that error anymore. So I consider this as solved. Thank you @bsrdjan