-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
We have been using node-sspi for years in an internal application. It was working great in Node 12 and earlier, however I was working on upgrading to Node 14 or 16 last week since the 12.X branch is now out of long-term support.
I am using the latest verion of NodeSSPI (0.2.9).
Again, this error does not occur in Node 12.22.12, but it does in both 14.19.1 and 16.15.0
The error seems to occur after refreshing the front-end page a couple of times.
Here is the truncated error message:
Uncaught Error Error: Invalid argument
--- generic ---
at init (node:internal/inspector_async_hook:25:19)
at emitInitNative (node:internal/async_hooks:201:43)
at main.authenticate (c:\applications\myapp\node_modules\node-sspi\index.js:61:11)
at <anonymous> (c:\applications\myapp\src\app.ts:76:25)
The line in myapp from the traceback is where nodeSSPIObj.authenticate is called:
app.use(function (req: any, res: any, next: any) {
try{
var nodeSSPI = require('node-sspi');
var nodeSSPIObj = new nodeSSPI();
nodeSSPIObj.authenticate(req, res, function (err: any) {
if(err){
console.error(err);
}
res.finished || next();
});
}
catch (err){
console.error(err)
}
});
I am unable to even catch the error so not sure if something is happening in the native code which causes Node to crash.
Update 2022-05-19
I attached to the process from Visual Studio while my node app was running in order to debug the NodeSSPI native code. I was able to break on the exception:
Exception thrown at 0x00007FFD97504F69 in node.exe: Microsoft C++ exception: Napi::Error at memory location 0x00000044792FE980.
Here is the Call Stack at the point of the exception being thrown:
nodeSSPI.node!Napi::Object::Get(Napi::Value key) Line 1007 C++
nodeSSPI.node!WrapUpAsyncAfterAuth(const Napi::Env env, Baton * pBaton) Line 415 C++
nodeSSPI.node!AsyncAfterSSPIAuth(Napi::Env env, Baton * pBaton) Line 788 C++
nodeSSPI.node!AsyncSSPIWorker::OnOK() Line 952 C++
nodeSSPI.node!Napi::AsyncWorker::OnWorkComplete::__l5::<lambda>() Line 3733 C++
nodeSSPI.node!Napi::details::WrapCallback<void * <lambda>(void)>(Napi::AsyncWorker::OnWorkComplete::__l5::void * <lambda>(void) callback) Line 61 C++
nodeSSPI.node!Napi::AsyncWorker::OnWorkComplete(napi_env__ * __formal, napi_status status, void * this_pointer) Line 3730 C++