pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
211 stars 145 forks source link

Invoke-PnPSiteTemplate fails on client's mac on a specific (slow) internet connection #767

Open gingemonster opened 2 years ago

gingemonster commented 2 years ago

Reporting an Issue or Missing Feature

Invoke-PnPSiteTemplate fails on clients mac on a specific (slow) internet connection but works on other users computers and on other internet connections with the same user and macbook.

Expected behavior

Should take a template file on local disk that has been created by Get-PnPSiteTemplate and apply the template including lists, files, branding and pages to the new site.

To be clear this is one part of a larger script that clones an entire site to a new one and works on all but one users internet connection

Actual behavior

With debug logging in you can see Invoke-PnPSiteTemplate create the lists, add the files then throws the following error and stops applying the template leaving a new site without the pages being created:

pwsh Information: 0 : 2022-10-18 10:09:34.4829 [ProvisioningTemplate WebHook Call] [18] [Debug] Code execution scope started 0ms 128a7087-f894-4253-8af9-327c89b0dd93 pwsh Information: 0 : 2022-10-18 10:09:34.4830 [ProvisioningTemplate WebHook Call] [18] [Debug] Code execution scope ended 0 Message : Value cannot be null. (Parameter 'clientObject') 128a708Stacktrace : at Microsoft.SharePoint.Client.ClientRuntimeContext.Load[T](T clientObject, Expression1[] retrievals) at PnP.Framework.Provisioning.ObjectHandlers.ObjectFiles.CheckOutIfNeeded(Web web, File targetFile) at PnP.Framework.Provisioning.ObjectHandlers.ObjectFiles.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean
calledFromHierarchy, TokenParser tokenParser)
at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)
at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet() in
c:\build\src\Commands\Provisioning\Site\InvokeSiteTemplate.cs:line 327
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in
c:\build\src\Commands\Base\PnPSharePointCmdlet.cs:line 143
ScriptLineNumber : 49
InvocationInfo : System.Management.Automation.InvocationInfo
Exception : System.ArgumentNullException: Value cannot be null. (Parameter 'clientObject')
at Microsoft.SharePoint.Client.ClientRuntimeContext.Load[T](T clientObject, Expression1[] retrievals) at PnP.Framework.Provisioning.ObjectHandlers.ObjectFiles.CheckOutIfNeeded(Web web, File targetFile) at PnP.Framework.Provisioning.ObjectHandlers.ObjectFiles.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser) at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation) at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet() in c:\build\src\Commands\Provisioning\Site\InvokeSiteTemplate.cs:line 327 at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPSharePointCmdlet.cs:line 143 CorrelationId : 7dc86fa0-a029-5000-5430-457816039eac TimeStampUtc : 18/10/2022 09:09:34

Steps to reproduce behavior

Not possible to reproduce other than on 1 clients network which does appear to be pretty slow

Which operating system/environment are you running PnP PowerShell on?

latest powershell, latest pnp-sharepoint and latest osx

wilecoyotegenius commented 1 year ago

I am experiencing the same issue. Also on macOS, but in my case, with a fast network connection. @gingemonster Have you ever found a solution for this?

gingemonster commented 1 year ago

unfortunately not the client just dealt with it not working sometimes

wilecoyotegenius commented 1 year ago

For everyone that came across the same issue - for me the solution was to split one large template into multiple smaller ones.

Sent from Nokia 6310i


From: Brian Norman @.> Sent: Tuesday, May 2, 2023 5:01:11 PM To: pnp/pnpframework @.> Cc: Konrad K. @.>; Comment @.> Subject: Re: [pnp/pnpframework] Invoke-PnPSiteTemplate fails on client's mac on a specific (slow) internet connection (Issue #767)

unfortunately not the client just dealt with it not working sometimes

— Reply to this email directly, view it on GitHubhttps://github.com/pnp/pnpframework/issues/767#issuecomment-1531636185, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFJEAVRNGXQOQEFGJFKGLXLXEEOTPANCNFSM6AAAAAARH4Z7EA. You are receiving this because you commented.Message ID: @.***>