s-KaiNet/gulp-spsave

Status code 401 while saving

unnieayilliath opened this issue · 2 comments

Environment : SP 2013, basic NTLM auth

Error details:
[17:22:16] StatusCodeError in plugin "gulp-spsave"
Message:
401 - undefined
Details:
statusCode: 401
error: undefined
options: [object Object]
response: [object Object]
domainEmitter: [object Object]
domain: [object Object]
domainThrown: false
StatusCodeError: 401 - undefined
at new StatusCodeError (\Source\Repos\TypeScript-SP-StarterPack\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.plumbing.callback (\Source\Repos\TypeScript-SP-StarterPack\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (\Source\Repos\TypeScript-SP-StarterPack\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.self.callback (\Source\Repos\TypeScript-SP-StarterPack\node_modules\request\request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (\Source\Repos\TypeScript-SP-StarterPack\node_modules\request\request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (\Source\Repos\TypeScript-SP-StarterPack\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
From previous event:
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at \Source\Repos\TypeScript-SP-StarterPack\node_modules\sp-request\lib\src\core\SPRequest.js:46:18
From previous event:
at coreRequest (\Source\Repos\TypeScript-SP-StarterPack\node_modules\sp-request\lib\src\core\SPRequest.js:22:16)
at spRequestFunc (\Source\Repos\TypeScript-SP-StarterPack\node_modules\sp-request\lib\src\core\SPRequest.js:69:20)
at Function.spRequestFunc.(anonymous function) [as post] (\Source\Repos\TypeScript-SP-StarterPack\node_modules\sp-request\lib\src\core\SPRequest.js:109:24)
at \Source\Repos\TypeScript-SP-StarterPack\node_modules\sp-request\lib\src\core\SPRequest.js:87:27
From previous event:
at Function.spRequestFunc.requestDigest (\Source\Repos\TypeScript-SP-StarterPack\node_modules\sp-request\lib\src\core\SPRequest.js:79:16)
at \Source\Repos\TypeScript-SP-StarterPack\node_modules\spsave\lib\src\core\FileSaver.js:54:36
at bound (domain.js:301:14)
at runBound (domain.js:314:12)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at FileSaver.saveFile (\Source\Repos\TypeScript-SP-StarterPack\node_modules\spsave\lib\src\core\FileSaver.js:53:14)
at FileSaver.save (\Source\Repos\TypeScript-SP-StarterPack\node_modules\spsave\lib\src\core\FileSaver.js:38:18)
at saveSingleFile (\Source\Repos\TypeScript-SP-StarterPack\node_modules\spsave\lib\src\core\SPSave.js:80:76)
at \Source\Repos\TypeScript-SP-StarterPack\node_modules\spsave\lib\src\core\SPSave.js:41:13
From previous event:
at spsave (\Source\Repos\TypeScript-SP-StarterPack\node_modules\spsave\lib\src\core\SPSave.js:13:12)
at DestroyableTransform.uploadFile [as _transform] (\Source\Repos\TypeScript-SP-StarterPack\node_modules\gulp-spsave\index.js:42:7)
at DestroyableTransform.Transform._read (\Source\Repos\TypeScript-SP-StarterPack\node_modules\gulp-spsave\node_modules\readable-stream\lib_stream_transform.js:159:10)
at DestroyableTransform.Transform.write (\Source\Repos\TypeScript-SP-StarterPack\node_modules\gulp-spsave\node_modules\readable-stream\lib_stream_transform.js:147:83)
at doWrite (\Source\Repos\TypeScript-SP-StarterPack\node_modules\gulp-spsave\node_modules\readable-stream\lib_stream_writable.js:313:64)
at writeOrBuffer (\Source\Repos\TypeScript-SP-StarterPack\node_modules\gulp-spsave\node_modules\readable-stream\lib_stream_writable.js:302:5)
at DestroyableTransform.Writable.write (\Source\Repos\TypeScript-SP-StarterPack\node_modules\gulp-spsave\node_modules\readable-stream\lib_stream_writable.js:241:11)
at DestroyableTransform.ondata (\Source\Repos\TypeScript-SP-StarterPack\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:619:20)
at emitOne (events.js:116:13)
at DestroyableTransform.emit (events.js:211:7)
at addChunk (\Source\Repos\TypeScript-SP-StarterPack\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:291:12)
at readableAddChunk (\Source\Repos\TypeScript-SP-StarterPack\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:278:11)
at DestroyableTransform.Readable.push (\Source\Repos\TypeScript-SP-StarterPack\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:245:10)
at DestroyableTransform.Transform.push (\Source\Repos\TypeScript-SP-StarterPack\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:148:32)
at Pumpify.onReadable (\Source\Repos\TypeScript-SP-StarterPack\node_modules\to-through\index.js:25:14)
at emitNone (events.js:106:13)
at Pumpify.emit (events.js:208:7)
at emitReadable
(\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\node_modules\readable-stream\lib_stream_readable.js:504:10)
at emitReadable (\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\node_modules\readable-stream\lib_stream_readable.js:498:62)
at addChunk (\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\node_modules\readable-stream\lib_stream_readable.js:298:29)
at readableAddChunk (\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\node_modules\readable-stream\lib_stream_readable.js:278:11)
at Pumpify.Readable.push (\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\node_modules\readable-stream\lib_stream_readable.js:245:10)
at Pumpify.Duplexify._forward (\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\index.js:170:26)
at DestroyableTransform.onreadable (\Source\Repos\TypeScript-SP-StarterPack\node_modules\duplexify\index.js:134:10)
at emitNone (events.js:106:13)

Description:
I am trying to save files into SharePoint. I am working behind a corporate proxy and have set the proxy in the env variables as below:
set https_proxy=http://[company proxy url]
set http_proxy=http://[company proxy url]
set NODE_TLS_REJECT_UNAUTHORIZED=0

I have verified the above setting by logging the console.log(process.env.https_proxy);

The proxy value given is correct as I use it for npm and git and both of them works.

Hi,

it's very difficult to diagnose the root cause of such errors. Usually, it happens when NTLM v2 was enabled, but the library already supports NTLM v2.

Maybe the issue comes from a proxy, in that case, I can't suggest anything here...

Please also check that you don't have Kerberos setup. Kerberos isn't supported.