openssl-nodejs icon indicating copy to clipboard operation
openssl-nodejs copied to clipboard

TypeError: element.includes is not a function

Open ksw25 opened this issue 3 years ago • 3 comments

No matter what I do, I am facing this issue while using this library.

Example of coding:

 openssl(['x509', '-noout', '-text', '-in', ca.pem, function (err, buffer) {
    console.log(err.toString(), buffer.toString());
  }]);

or

openssl(['x509', '-noout', '-text', '-in', { name:'ca.pem', buffer: BufferVariable }], (output) => console.log(output.toString()));

Error:

{
    "errorType": "Runtime.UnhandledPromiseRejection",
    "errorMessage": "TypeError: element.includes is not a function",
    "reason": {
        "errorType": "TypeError",
        "errorMessage": "element.includes is not a function",
        "stack": [
            "TypeError: element.includes is not a function",
            "    at checkCommandForIO (/var/task/node_modules/@amzn/interceptor-core/node_modules/openssl-nodejs/src/index.js:17:46)",
            "    at openssl (/var/task/node_modules/@amzn/interceptor-core/node_modules/openssl-nodejs/src/index.js:69:13)",
            "    at getKeyFromURL (/var/task/node_modules/@amzn/interceptor-core/src/token-validator.js:53:3)",
            "    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
        ]
    },
    "promise": {},
    "stack": [
        "Runtime.UnhandledPromiseRejection: TypeError: element.includes is not a function",
        "    at process.<anonymous> (/var/runtime/index.js:35:15)",
        "    at process.emit (events.js:314:20)",
        "    at processPromiseRejections (internal/process/promises.js:209:33)",
        "    at processTicksAndRejections (internal/process/task_queues.js:98:32)"
    ]
}

ksw25 avatar Feb 08 '22 19:02 ksw25

@ksw25 hey man! Here's an alternative for this lib: https://www.npmjs.com/package/openssl-ts

marianozunino avatar Mar 04 '22 17:03 marianozunino

Change to { name: 'ca.pem', buffer: BufferVariable, includes: function(key){return false} }

wanghouqi avatar Sep 20 '22 08:09 wanghouqi

Hey @ksw25,
This error means that the file "ca.pem" is missing from the location expected. I'd double check what's going on with your paths etc, and even do fs.readdir to double check that it's there at run time.

monkeytronics avatar Apr 10 '23 21:04 monkeytronics