Bug in block Script node

i make script thats works well, but when try in Ob2 got error:InvocationException: privateKeyPem is not defined why is this if script is correct .

const crypto = require('crypto');

crypto.generateKeyPair('ec', {
  namedCurve: 'P-384',
}, (err, publicKey, privateKey) => {
  if (err) throw err;

  const publicKeyPem = publicKey.export({ type: 'spki', format: 'pem' });
  console.log(publicKeyPem);

  const privateKeyPem = privateKey.export({ type: 'pkcs8', format: 'pem' });
  console.log(privateKeyPem);

});

Maybe you tried to use the “privatekeypem” directly. First you need to define the output variable in script block, select the output variable, select string > type privatekeypem and try to call the variable anywhere in config it will work

the output are selected:

now can you said me what im doing wrong,please.

Hey mate, that’s not considered a bug. It’s actually something called “variable scope.” The environment doesn’t recognize the variable and will throw an error. In short, you’re trying to call a variable that doesn’t exist at that level—something like that.