pnp / sp-starter-kit

Modern SharePoint Starter Kit - End-to-end showcase solution to get started with modern experiences.
MIT License
763 stars 536 forks source link

Invoke-PnPTenantTemplate: Value cannot be null. (Parameter 'clientObject') #514

Open YeeSkywalker opened 3 years ago

YeeSkywalker commented 3 years ago

Category

Describe the bug

Expected or Desired Behavior

Finish installation process without error.

Observed Behavior

At some point of the provisioning I get the following error message:

Screen Shot 2021-10-21 at 11 15 37 AM

Steps to Reproduce

Follow steps of

  1. Run MS Powershell ISE as admin.
  2. Using O365 global admin account
  3. Run script: Connect-PnPOnline https://mytenant.sharepoint.com -Interactive
    Invoke-PnPTenantTemplate -Path ./starterkit.pnp

Environment Details (Development & Target environment)

ghost commented 3 years ago

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

eoverfield commented 3 years ago

Please try executing Set-PnPTraceLog -On -Level Debug before the invoke commandlet and provide the detailed output.

YeeSkywalker commented 3 years ago

Please try executing Set-PnPTraceLog -On -Level Debug before the invoke commandlet and provide the detailed output.

I executed Set-PnPTraceLog -On -LogFile "output.txt" -Level Debug before the invoke commandlet, but the output file is empty. It seems that the PnPTraceLog problem is similar to pnp/powershell#1061. I am wondering if there is other way to trace the debug process. Thanks for your help.

eoverfield commented 3 years ago

Remove -LogFile "output.txt" and let messages appear in the console as a next step. I'd be interested to see the last 10-30 lines before the script bails.

ghost commented 3 years ago

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

YeeSkywalker commented 3 years ago

Hey there, sorry for late responding. I have tried 'Set-PnPTraceLog -On -Level Debug' before 'Invoke-PnPTenantTemplate -Path starterkit.pnp', but nothing showed up in the terminal. However, I used 'Get-PnPException' and I got the following message:

Screen Shot 2021-11-04 at 1 48 08 PM
iezekiel commented 1 year ago

I had the same error on macOS PowerShell. The detailed error was pwsh Information: 0 : 2023-02-15 09:17:50.8911 [PnP.Framework] [0] [Information]File modernOffice_002.jpg retrieved from folder resources\images 0ms pwsh Information: 0 : 2023-02-15 09:17:50.8911 [Files] [19] [Debug] Uploading file resources\images\modernOffice_002.jpg 597ms 5cdb19cc-9aae-4b17-8f88-5d37f9ca1fc9 pwsh Error: 0 : 2023-02-15 09:17:52.3587 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: The file or folder name "SiteAssets/resources\images\modernOffice_002.jpg" contains invalid characters. Please use a different name. Common invalid characters include the following: # % * : < > ? / | As I understand the paths are mixed up "SiteAssets/resources\images\modernOffice_002.jpg".

diegoadelgado commented 2 months ago

Same error here on MacOS.

pwsh Information: 0 : 2024-09-04 20:08:42.7671  [PnP.Framework] [0]     [Information]   File contoso_report.pptx retrieved from folder resources\documents      0ms
pwsh Information: 0 : 2024-09-04 20:08:42.7672  [Files] [23]    [Debug] Uploading file resources\documents\contoso_report.pptx  26771ms 0e55bd2d-19a5-40c9-966b-95db8c2ddcaa
pwsh Error: 0 : 2024-09-04 20:08:43.0606        [PnP.Framework] [0]     [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: The file or folder name "Shared Documents/resources\documents\contoso_report.pptx" contains invalid characters. Please use a different name. Common invalid characters include the following: # % * : < > ? /  |
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
Invoke-PnPTenantTemplate: Value cannot be null. (Parameter 'clientObject')    

It's happening when copying most of the files in resources/images/*

eoverfield commented 1 month ago

As best I can tell, the issue with MacOS is PnP PowerShell and not the starter kit.

The kit does look to add sample files to doc library. Within the provisioning script, for example, this is achieved via:

<pnp:File Src="resources\documents\contoso_report.pptx" Overwrite="true" Folder="{resource:SharedDocumentsFolder}"></pnp:File>

It looks as though PnP PowerShell is then combining the src with the folder and adding this "/" which is not properly interpreted by MacOS PnP PowerShell.

You might need to reach out the PnP PowerShell community and provide what you are seeing along with the PnP Template lines that are throwing the error, i.e. the line provided above.