Closed LuisPeregrinaPSL closed 3 years ago
Note, I'm not admin in sharepoint, I only have access to the folder in remoteFolders
Getting the server version also shows the same error. Could it be a problem with auth?
Hello @LuisPeregrinaPSL -
I agree with you that this is likely an authentication issue.
VSCode does have an advanced debugging tool - to enable it go to Help -> Toggle Development Tools
, or using <ctrl-shift-i>
(windows). This opens the chrome developer console and you can view much of the console logging statements that are not made available in the extension context or output window.
Second - I do need to continue refining the SPGo output/debug logging components. I've found that SP auth errors do not JSON.stringify()
at all - which is why you see the empty output:
15/7/2020 16:34:25] Error Detail:
[15/7/2020 16:34:25] ----------------------
[15/7/2020 16:34:25] {}
Let me know the detailed errors you are seeing and I'll keep working to improve logging.
Unfortunately I can't find any reference to spgo in the developer tools, it seems vscode uses another process to run extensions.
When I use bad credentials I get something I would expect as an error message:
[17/7/2020 9:57:46] ================================ ERROR ================================
[17/7/2020 9:57:46] <s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:FailedAuthentication</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">ID3242: The security token could not be authenticated or authorized.</s:Text>
</s:Reason>
</s:Fault>
[17/7/2020 9:57:46] Error Detail:
[17/7/2020 9:57:46] ----------------------
[17/7/2020 9:57:46] {}
[17/7/2020 9:57:46] ===============================================================================
Used digest, it said 0 files, changed back to ADFS and now the console shows this: Error in getFolderContent: [31mCannot read property 'map' of undefined[39m
Hello @LuisPeregrinaPSL
I'm still trying to track down the root cause of this issue. I grabbed the latest source for sppull, the library that SPGo uses to download files from SharePoint, and there are two map statement in the getFolderContent
87. let metadataStr: string = this.options.metaFields.map(fieldName => {
...and
121. files: (response.body.d.Files.results || []).map((file) => {
I suspect the second instance on line 121 is the cause of the error. This would indicate that the response from the SharePoint API is something other than a list of objects (e.g. an error, or something else).
Since you are familiar with JS + Node apps, I was wondering if you could help me debug using the following steps:
basic usage
header in the sppull readme.context
and options
objects.I can then compare that to how SPGo manages these objects and hopefully I can find the root cause.
Thanks for your help!
Ok, the error is coming from that package, here is the offending line: \node-sp-auth\lib\src\auth\resolvers\AdfsCredentials.js:55:22
Using ondemand showed a login page and that went through without a problem
Thanks for your quick response!
Can you share the following code files you wrote (please mask password info) so that I can create an issue in the node-so-auth
repo?
package.json:
{
"name": "sharepoint",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"sppull": "^2.6.6"
}
}
index.js:
const { sppull } = require("sppull");
const context = {
siteUrl: "https://xxx.sharepoint.com/sites/xxx",
creds: {
username: "xxx@xxx",
password: "xxx",
relyingParty: "urn:federation:MicrosoftOnline",
adfsUrl: "https://xxx/adfs/ls/"
}
};
const options = {
spRootFolder: "/xxx/",
dlRootFolder: "./src"
};
sppull(context, options)
.then((downloadResults) => {
console.log("Files are downloaded");
console.log("For more, please check the results", JSON.stringify(downloadResults));
})
.catch((err) => {
console.log("Core error has happened", err);
});
@LuisPeregrinaPSL - unfortunately VSCode blocks the external window, so I am not able to use the ondemand/interactive authentication functionality in node-sp-auth
.
Did you see the same error Cannot read property 'map' of undefined
with your test app?
@LuisPeregrinaPSL - do you have any updates on testing, or was VSCode eating the interactive login window a deal breaker on this one?
Sorry, forgot about this one, I stopped using it.
Closing.
Note: for support questions, please use stackoverflow and tag the post with #spgo.
I'm submitting a ...
What is the current behavior? [15/7/2020 16:34:14] SPGo enabled. [15/7/2020 16:34:25] ================================ ERROR ================================
[15/7/2020 16:34:25] Cannot read property 'map' of undefined [15/7/2020 16:34:25] Error Detail: [15/7/2020 16:34:25] ---------------------- [15/7/2020 16:34:25] {} [15/7/2020 16:34:25] ===============================================================================
If the current behavior is a bug, please
spgo.json
file (You may replace corporate PII with "xxx")What is the expected behavior? Files get downloaded
Please tell us about your environment:
I'm familiar with javascript/node ecosystem, is there a way to debug or get a better log level for the output of this plugin?