Invoke-PnPSiteTemplate fails on client's mac on a specific (slow) internet connection
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PnP.Framework.Provisioning.ObjectHandlers.ObjectFiles.CheckOutIfNeeded and its caller ProvisionObjects, then inspect InvokeSiteTemplate.cs at line 327. Reproduce the failure on the reported slow macOS connection if possible; done means identifying why the clientObject is null and ensuring template application proceeds far enough to create the pages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100