Provisioning the modern site along with custom SPFx webpart using CSOM is not working

%3CLINGO-SUB%20id%3D%22lingo-sub-155102%22%20slang%3D%22en-US%22%3EProvisioning%20the%20modern%20site%20along%20with%20custom%20SPFx%20webpart%20using%20CSOM%20is%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-155102%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20created%20a%20tool%20to%20provision%20communication%20sites%20on%20demand.%20We%20also%20have%20a%20source%20site%20created%20manually%20and%20added%20custom%20web%20parts%20(SPFx%20web%20parts).%3C%2FP%3E%0A%3CP%3EWhen%20the%20tool%20executes%20GetProvisioningTemplate%2C%20the%20XML%20has%20the%20information%20of%20all%20the%20custom%20web%20parts%20under%20section%20ClientSitePages.%20But%20when%20the%20tool%20executes%20ApplyProvisioningTemplate%20the%20code%20fails%20at%20the%20time%20of%20applying%20ClientSitePages%20with%20an%20error%20%22Value%20cannot%20be%20null.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EParameter%20name%3A%20source%20%22%3C%2FP%3E%0A%3CP%3EStarted%20applying%20the%20template%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A48%3A19%2C%20018%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%201%7C9-Regional%20Settings%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A48%3A19%2C%20353%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%202%7C9-Site%20Security%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A48%3A21%2C%20557%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%203%7C9-Features%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A48%3A26%2C%20842%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%204%7C9-List%20instances%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A54%3A45%2C%20278%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%205%7C9-Tenant%20Settings%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A54%3A45%2C%20294%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%206%7C9-Application%20Lifecycle%20Management%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A54%3A56%2C%20309%20%5B1%5D%20INFO%20SiteProvisioningUtility.Program%20-%207%7C9-ClientSidePages%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EFebruary%2006%2C%202018%2018%3A55%3A01%2C%20356%20%5B1%5D%20ERROR%20SiteProvisioningUtility.Program%20-%20Error%20occurred%20while%20applying%20the%20template%20%3ASystem.ArgumentNullException%3A%20Value%20cannot%20be%20null.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EParameter%20name%3A%20source%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3Eat%20System.Linq.Enumerable.Any%5BTSource%5D(IEnumerable%601%20source)%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3Eat%20OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.ProvisionObjects(Web%20web%2C%20ProvisioningTemplate%20template%2C%20TokenParser%20parser%2C%20ProvisioningTemplateApplyingInformation%20applyingInformation)%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3Eat%20OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web%20web%2C%20ProvisioningTemplate%20template%2C%20ProvisioningTemplateApplyingInformation%20provisioningInfo)%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3Eat%20Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web%20web%2C%20ProvisioningTemplate%20template%2C%20ProvisioningTemplateApplyingInformation%20applyingInformation)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-155102%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

We have created a tool to provision communication sites on demand. We also have a source site created manually and added custom web parts (SPFx web parts).

When the tool executes GetProvisioningTemplate, the XML has the information of all the custom web parts under section ClientSitePages. But when the tool executes ApplyProvisioningTemplate the code fails at the time of applying ClientSitePages with an error "Value cannot be null. 
Parameter name: source "

Started applying the template 
February 06, 2018 18:48:19, 018 [1] INFO SiteProvisioningUtility.Program - 1|9-Regional Settings 
February 06, 2018 18:48:19, 353 [1] INFO SiteProvisioningUtility.Program - 2|9-Site Security 
February 06, 2018 18:48:21, 557 [1] INFO SiteProvisioningUtility.Program - 3|9-Features 
February 06, 2018 18:48:26, 842 [1] INFO SiteProvisioningUtility.Program - 4|9-List instances 
February 06, 2018 18:54:45, 278 [1] INFO SiteProvisioningUtility.Program - 5|9-Tenant Settings 
February 06, 2018 18:54:45, 294 [1] INFO SiteProvisioningUtility.Program - 6|9-Application Lifecycle Management 
February 06, 2018 18:54:56, 309 [1] INFO SiteProvisioningUtility.Program - 7|9-ClientSidePages 
February 06, 2018 18:55:01, 356 [1] ERROR SiteProvisioningUtility.Program - Error occurred while applying the template :System.ArgumentNullException: Value cannot be null. 
Parameter name: source 
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) 
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) 
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo) 
at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)

0 Replies