Closed kyleschaeffer closed 5 years ago
Hello @kyleschaeffer ! I'm unable to reproduce the issue you are experiencing with SPGo and Visual Studio Code 1.31.
Diving into this, can you help out with a few environmental details for me?
Couple other things which may be helpful: SPGo is built on top of a few other SharePoint-specific node packages, including SPPull and SPSave. Can you review the following two issues and see if there is any correlation with your current configuration:
NTLM v2 btw is now (for half a year I guess) supported, so should not be an issue. Also, the interesting point is that something related to the update of the VSCode does the thing which when affecting on authentication.
Hi, all. Thanks for the quick feedback. Here is my current config:
{
"sourceDirectory": "dist",
"sharePointSiteUrl": "https://site-url-appears-here.org/",
"publishingScope": "None",
"authenticationType": "NTLM",
"checkInMessage": "Automatically deployed via solution",
"storeCredentials": true,
"remoteFolders": [
"/_catalogs/masterpage/nucleus",
"/_catalogs/wp"
]
}
As you can see, it's NTLM authentication to an on-premises 2016 environment. I don't get much output in the SPGo output log, other than this:
================================ ERROR ================================
401 - undefined
===============================================================================
I get this message when trying to do pretty much anything, including the "Reset Credentials" command.
The spsave
package is actually being used for this same environment with the same NTLM configuration in another package that we wrote (https://github.com/sprtus/pushsp), and it works just fine there. As I mentioned, it also works fine if I downgrade to the November 2018 version of Code.
Interesting - it appears that this issue is related to either NTLM, or a change to VSCode from 1.30.x to 1.31.x. The only thing I can think of here is that VSCode is now using node v10.
Unfortunately at this time I do not have access to an ntlm-secured SharePoint environment. At one point MS had an all-in-one VM for testing/evaluation purposes, but I can't seem to find it. @koltyakov do you know if there is an available VM I could use?
@kyleschaeffer - sorry to pepper you with more questions, but can you help with the following:
node -v
)help->Toggle Developer Tools
) and see if there are any additional errors available in the console window?Thanks all!
@sg-chrishasz can let you into one of our dev on-prem environments tomorrow (it's 11+ pm here now), also it'll be NTLMv1. Will DM you with creds. But I still not sure that it's not related to some VSCode plugin specific something.
Also, after updating, @kyleschaeffer did you ever tried to drop files containing creds hash and re-enter username and password?
Having same issue, after the vscode update, started to get 401 error, when i insert my credentials
I'm also having the same issue. If I can help by providing logs or config just let me know.
Locally I'm using Node.js v10.13.0. When I get the 401 - undefined
message, this is thrown in the dev tools:
[31m[09:37:19] spsave: StatusCodeError: 401 - undefined[39m
[31m at new StatusCodeError (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/request-promise-core/lib/errors.js:32:15)[39m
[31m at Request.module.exports.plumbing.callback (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/request-promise-core/lib/plumbing.js:104:33)[39m
[31m at Request.RP$callback [as _callback] (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/request-promise-core/lib/plumbing.js:46:31)[39m
[31m at Request.init.self.callback (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/request/request.js:185:22)[39m
[31m at Request.emit (events.js:182:13)[39m
[31m at Request.EventEmitter.emit (domain.js:442:20)[39m
[31m at Request.<anonymous> (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/request/request.js:1157:10)[39m
[31m at Request.emit (events.js:182:13)[39m
[31m at Request.EventEmitter.emit (domain.js:442:20)[39m
[31m at IncomingMessage.<anonymous> (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/request/request.js:1079:12)[39m
[31m at Object.onceWrapper (events.js:273:13)[39m
[31m at IncomingMessage.emit (events.js:187:15)[39m
[31m at IncomingMessage.EventEmitter.emit (domain.js:442:20)[39m
[31m at endReadableNT (_stream_readable.js:1090:12)[39m
[31m at process._tickCallback (internal/process/next_tick.js:63:19)[39m
[31mFrom previous event:[39m
[31m at coreRequest (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/sp-request/lib/src/core/SPRequest.js:22:16)[39m
[31m at spRequestFunc (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/sp-request/lib/src/core/SPRequest.js:69:20)[39m
[31m at Function.forEach.spRequestFunc.(anonymous function) [as get] (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/sp-request/lib/src/core/SPRequest.js:109:24)[39m
[31m at FileSaver.getFileByUrl (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/FileSaver.js:211:31)[39m
[31m at /Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/FileSaver.js:176:19[39m
[31mFrom previous event:[39m
[31m at FileSaver.checkoutFile (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/FileSaver.js:171:23)[39m
[31m at FileSaver.saveFile (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/FileSaver.js:51:35)[39m
[31m at FileSaver.save (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/FileSaver.js:38:18)[39m
[31m at saveSingleFile (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/SPSave.js:80:76)[39m
[31m at exports.spsave (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/SPSave.js:41:13)[39m
[31mFrom previous event:[39m
[31m at Object.spsave (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/node_modules/spsave/lib/src/core/SPSave.js:13:12)[39m
[31m at uploadFiles.requestHelper_1.RequestHelper.setNtlmHeader.then.Promise (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/out/src/gateway/spFileGateway.js:130:26)[39m
[31m at new Promise (<anonymous>)[39m
[31m at uploadFiles.requestHelper_1.RequestHelper.setNtlmHeader.then (/Users/kyle/.vscode/extensions/sitego.spgo-1.3.4/out/src/gateway/spFileGateway.js:129:20)[39m
Interestingly enough, when I switch to my Office 365 instance and try deploying using SPGo, I get a different error:
================================ ERROR ================================
input.resume is not a function
===============================================================================
Nothing in dev tools when I get this message.
I'm happy to start up a quick Zoom meeting/screen share to help troubleshoot today if needed. This is a client environment so I can't grant access directly, but perhaps we can sort it out.
Good news, Everyone! :farnsworth:
I am able to reproduce this error with the NTLM environment that @koltyakov provided. I'm working on the root cause right now and will post an update once I have an estimate for the fix.
Thanks, all, for your patience!
Update: I'm still debugging this issue, but have not found a root cause yet. It definitely affects all NTLM environments and is, in my testing, limited to VSCode 1.31 only.
To try to isolate the issue, I created a new extension using the yo
yeoman command, and built a minimal NTLM auth request using sp-request and experienced the exact same error as when working with SPGo.
I have a few theories, that I'm going to keep pursuing:
I'll provide updates as I have them. Thanks for your patience and debugging help, everyone!
So I'm not going crazy and it's not just me... I just upgraded to 1.31 and I can no longer save my files to SharePoint. Awaiting the solution. For now I will try to roll back.
EDIT: I just installed 1.30, which was my previous working version and I am getting a different error now:
================================ ERROR ================================
Invalid argument
===============================================================================
Now I'm back to
================================ ERROR ================================
401 - undefined
===============================================================================
I had to turn off Auto update feature! As it updated for me and when I restarted, I was back the same error. It is working again with version 1.30
JFYI I also look at this issue because it seems it's somehow closely related to node-sp-auth vs vscode 1.31 vs NTLM auth. I did exactly the same test with minimal vscode extension with sp-request and was able to reproduce the issue.
Tonight I'm going to look into two things:
@s-KaiNet do you have any recommendations on how best to approach this, or are you able to help troubleshoot?
@sg-chrishasz I've just found the root cause, give me a few minutes I will post an update :)
Quick fix for the current version of vscode (set Proxy support for extensions to On, actually Off also works, but I'm not sure about possible negative effects). vscode restart required:
This proxy setting (when set to override
) somehow globally overrides https.Agent
. https.Agent
in turn is used internally when performing NTLM auth. I found an issue in vscode repository where they discuss something related to these changes around https.Agent
.
The big question is how to overcome it without changing vscode settings. I also don't know how it (Proxy for extensions: On) affects other extensions. This setting is new in vscode 1.31. From the other side it can be treated as a bug from vscode, because other extensions, which use https.Agent might also break.
Tomorrow I will try take a closer look at what's possible here.
Thanks @s-KaiNet! I'll keep researching the VSCode proxyAgent issue as well and post up here if I find anything.
Couple notes before I sign off for the night:
.... that said, I ran wireshark against a successful and unsuccessful ntlm request, and there were no obvious differences between the two request/response pairs.
I can put code into SPGo to manually disable the proxy override, but that doesn't feel like a well-formed solution. At this point, I think our best bet would be to ask the VSCode team for guidance. @s-KaiNet I'm interested to hear your investigations.
I discovered exactly the same thing. At this point I can't see any easy way to fix it in node-sp-auth
, thus we definitly should ask vscode if it's a bug or not (probably comment at the same thread).
The keypoint here is that we don't use proxy at all, we use only http.agent
, which is get overwritten by vscode. For me it doesn't feel like exactly right behaviour of vscode.
The right behaviour for me is to override http
things only in case if proxy settings were specified in vscode. Currently they override despite if actual proxy was specified or not.
wow that proxy-setting really helped, thank you very much
Hey, thanks, that proxy settings worked for me too,
For those who are in doubt how to do it:
1) press ctrl+shift+p 2) Open User Settings 3) Proxy support 4) Set it to off
That worked for me :)
Someone else has recently created an issue for this in the VSCode repository. https://github.com/Microsoft/vscode/issues/68531
I added more context here: https://github.com/Microsoft/vscode/issues/68531#issuecomment-463425517
Works great now with the setting changed. Thanks very much for your assistance!
This issue is back with VS Code 1.56.1 and SharePoint 2019 on-prem. Setting the proxy from override to off fixed the issue for me.
This issue is back with VS Code 1.56.1 and SharePoint 2019 on-prem. Setting the proxy from override to off fixed the issue for me.
This is also affecting me on our 2013 on-prem. Turning off the proxy setting fixed this for me too. @mellolr1 I'm glad you commented on this as it stopped me from going mad :-)
After updating to VSCode 1.31 (January 2019 update), the SPGo extension appears to break. Every operation results in "401 - undefined" in the output.
I verified this by rolling back to the November 2018 build (1.30), and everything worked great.
Also, great work on this extension, it's awesome!