Pnp-sites-core: Creation of modern team sites fails

Created on 27 Nov 2019  路  15Comments  路  Source: pnp/PnP-Sites-Core

Category

[x ] Bug
[ ] Enhancement

Environment

[x ] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

If SharePoint on-premises, what's exact CU version:

Expected or Desired Behavior

I want to create a new modern team site with the CSOM method CreateSiteAsync.
2 days ago everything worked fine and now the creation stops to work.

Observed Behavior

The site is created in SharePoint but the method runs into a timeout and throws an exception.

System.Exception: Server side provisioning of this web did not finish after waiting for 600000 milliseconds.
OfficeDevPnP.Core.Sites.SiteCollection.WaitForProvisioningIsComplete(Web web, Int32 maxRetryCount, Int32 retryDelay)

Steps to Reproduce

var creationInformation = new TeamSiteCollectionCreationInformation();
creationInformation.Alias = "ALIAS";
creationInformation.DisplayName = "TITLE";
creationInformation.Description = "DESCRIPTION";
creationInformation.IsPublic = false;

// this will create the site but never returns and run into a timeout
clientContext.CreateSiteAsync(creationInformation).GetAwaiter().GetResult();

Needs

Most helpful comment

Same problem here.

According to my investigations of the issue, it seems to be related to the provisioning steps after the creation of the site. It seems like when these steps are finished they should set the "IsProvisioningComplete" parameter of the web object to true. The site creation in its standard configuration waits for this parameter to be set true. If this doesn't happen for a certain amount of time an error is thrown. (Or at least was thrown in an older version, now it waits for 20min and just logs a warning, if I understand the changelog correctly)

If I have this problem with a tenant I can "work around" this by accessing the site in a browser, but this isn't a real solution for automated scenarios.

Additional info:

  • For me happens only with communication sites
  • Tested with using the "New-PnPSite" command from PnP-PowerShell in version 3.14.1910.1 (10min wait => error) and 3.15.1911.0 (20min wait without error)
  • Tested on multiple tenants, doesn't occur on all of them
  • When accessing the site by browser, script blocker like uBlock have to be deactivated for the "IsProvisioningComplete" parameter to be set correctly.

All 15 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

We have the exactly same issue! Any chance that someone will look at it?

Same problem here.

According to my investigations of the issue, it seems to be related to the provisioning steps after the creation of the site. It seems like when these steps are finished they should set the "IsProvisioningComplete" parameter of the web object to true. The site creation in its standard configuration waits for this parameter to be set true. If this doesn't happen for a certain amount of time an error is thrown. (Or at least was thrown in an older version, now it waits for 20min and just logs a warning, if I understand the changelog correctly)

If I have this problem with a tenant I can "work around" this by accessing the site in a browser, but this isn't a real solution for automated scenarios.

Additional info:

  • For me happens only with communication sites
  • Tested with using the "New-PnPSite" command from PnP-PowerShell in version 3.14.1910.1 (10min wait => error) and 3.15.1911.0 (20min wait without error)
  • Tested on multiple tenants, doesn't occur on all of them
  • When accessing the site by browser, script blocker like uBlock have to be deactivated for the "IsProvisioningComplete" parameter to be set correctly.

We just update from the September to the November release and we are experiencing the exact same issue.
Creating a site is fairly quickly done, when I watch the sites in the SharePoint Admin center, however the async action of creating the site never exists the wait, or sometimes continues after 20 minutes. We are creating sitecollections in batches creating Modern Teamssites, _not_ CommunicationSites.
We are using the following code:
```c#
var clientContextFactory = new ClientContextFactory(settings);
using (var adminClientcontext= clientContextFactory.CreateTenantAdminContext())
{
var properties = new TeamSiteCollectionCreationInformation()
{
Alias = settings.SiteGroupAlias,
DisplayName = settings.SiteTitle,
IsPublic = false,
};
adminClientcontext.CreateSiteAsync(properties).Wait();
}

```

  • Testsed on multiple tenants, experiencing same behaviour.
  • Also factored back in the old code from the september release:

    • Issue is resolved using the old Sitecollection.cs, SiteCollectionCreationInformation.cs and ObjectHierarchySequenceSites.cs (and adjusting ClientContextExtensions.cs and TenantExtensions.cs for solving incompatibilty with new methods) .

Hi Microsoft any news about this issue?

Is that API / framework covered by any SLA? How should a company use that interface if nobody cares at Microsoft and we have to explain it to our customers: there is nothing what we can do about it.

As a workaround you could use the _"CreateAsync"_ method from the _SiteCollection_ class, with either the _"delayAfterCreation"_ set to a value around 1 or the _"noWait"_ parameter set to true. Then the method doesn't wait until the _"IsProvisioningComplete"_ property is set to true. (This should be the old way it was handled).

For my use case with PnP PowerShell scripts this wasn't possible until the newest version released three days ago. PnP-PowerShell now seems to default to not waiting, which is the same behavior as before this property was introduced. And if you want you can wait, but aren't forced to.

Important
This things above are only workarounds and it would be really nice if the original problem would be fixed.

As mentioned by @reusto specifying a delayAfterCreation of 1 will make the method not execute the WaitForIsProvisioningComplete. If you're using PnP PowerShell then upgrade to the December version, it by default does not wait for IsProvisioningComplete unless you specify -Wait.

The IsProvisioningComplete checks for the default backend async provisioning logic and the timing for that work to finish can vary a lot. If your provisioning scenarios do not depend on all of the OOB provisioning steps to be completed, then skipping the wait via above mentioned approaches will get you unblocked.

it seems that the timeout is not a problem anymore, but now something strange happens.
the creation takes about 20 minutes and a site is created, but not with the specified alias.
instead it's the alias followed by a 2.
the office 365 group has the correct alias, but the sharepoint site not.
what i also have checked, the site 100% doesn't exist.

normally the alias has the following pattern WS_\d{6} but the created team site has the alias
WS_\d{6}2.

Not to sure about the part with the 2 at the end, but for the part with the 20min:
There was a change to the implementation which now waits 20min instead of the 10min before. Additionally the error was removed and replaced by logging. (If I understand the part in the changelog correctly [see "Changed" part for 3.15.1911.0])

ok, i will try with the SiteCollection method and a delay of 1 second or 1 minute (it's not important that it's completed immediate).

The waiting happens after the request and it's not retrying the request...so I don't think the "2" issue is related to the waiting, but nevertheless quite strange. Could you do a fiddler request and paste JSON that's being sent over for the site collection creation?

At the moment the SiteCollection workaround seems to work.
(I will have to wait until the o365 group has been created before i proceed.

The fiddler request i will have to do when I'm back at the office.
Maybe I will get in contact with you at the ESPC @jansenbe because I have a question about that.

Got this same problem that creating a site when I do not set the noWait property to true. This is taking about 20 minutes every time, so my guess is that there are some things on the SharePoint server side which do not work entirely as expected. Setting the noWait property to true is fixing some things, but now I am seeing property bag values which I added for sure getting removed. Does anyone have a solution for this one?

Edit: This does (off course) not happen everytime, gheghe. I'm thinking about a azure function to handle this after provisioning is completed because I can't have my users waiting that long.

The issue with the part 2 in the end may be related to this finding some weeks back. If you create a site with alias ex. XX000001 and there is a site in deleted site recycle bin with same URL XX000001.
Then the new site will be suffixed with unique number.

This is also related to an issue with function to verify if the alias exists (context.AliasExistsAsync(alias)), this return false when test for XX000001, but site is created with URL XX0000012.

Was this page helpful?
0 / 5 - 0 ratings