Closed jcangelosi closed 6 years ago
If you upload the same package file through the UI do you get an invalid package error?
Thank you for your interest in the sp-pnp-js library. We wanted to mention that this library is being deprecated in July, 2018 in favor of the new scoped pnpjs libraries. You should begin transitioning your existing projects when possible, or start new projects with the new libraries. Please see the transition guide for more details on migrating and be sure to let us know if you have any questions. Thanks!
No, uploading the package through the UI works fine.
Hey @jcangelosi,
What fetchClientFactory do you use?
Can it be that it was sp-pnp-node
?
After some research, I found an issue in sp-pnp-node
and fixed it in ver. 2.1.0.
This:
sp.setup({
sp: {
fetchClientFactory: () => new PnpNode({
siteUrl: context.siteUrl,
authOptions: context.authOptions
})
}
});
const web = new Web(context.siteUrl);
const content = fs.readFileSync(fileLocation).buffer;
return web
.getAppCatalog()
.add(fileName, content)
.catch(error => {
console.log(error.data.responseBody);
});
works for me now, but failed before with the same error messages as yours.
UPD: Oh, and btw I only tested with new @pnp scoped library. And highly encourage to move to a new ver of PnPjs.
I think that was the problem, thanks for the fix!
Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your needs please complete the below template to ensure we have the details to help. Thanks!
Please check out the Developer Guide to see if your question is already addressed there. This will help us ensure our documentation covers the most frequent questions.
Category
[ ] Enhancement
[ ] Bug
[X] Question
Version
Please specify what version of the library you are using: [ 3.0.8 ]
Question
I was trying to upload a solution in node with the pnp library and I haven't been able to make it work at all. Im not sure what my error may be. I'm using fs to retrieve the package from my computer, when I retrieve it as utf8 the app is uploaded to the site but I get the following message: "Invalid SharePoint App package. Error: File contains corrupted data" in the app catalog after checking it. If I try to read my file as a buffer the page just returns a 500 internal server error and the app is not uploaded.
Steps to Reproduce
Thanks!