SitecorePowerShell / Console

Sitecore PowerShell Extensions
https://doc.sitecorepowershell.com/
Other
114 stars 71 forks source link

Executing Publish-Item against Experence Edge throws an error #1314

Closed RAhnemann closed 1 year ago

RAhnemann commented 1 year ago

Expected Behavior

Item is published to Experience Edge

Actual Behavior

"Publish-Item : Object reference not set to an instance of an object" message is thrown.

Steps to Reproduce the Problem

If your publishing db is named "experienceedge", run:

_Publish-Item -Path "Path_toitem" -Target "experienceedge"

It will show the error. If you change your Target to "web" it will work as expected.

Versions

Sitecore PowerShell Extensions 6.4.0.22430 Sitecore 10.3 Sitecore Edge Connector 21.x

*note, if you

RAhnemann commented 1 year ago

image

alan-null commented 1 year ago

@RAhnemann It will be solved in Edge Connector, reported issue for them, id: 597269

In case you have to hotfix your onPrem instance it could be fixed in SPE with these lines: image

CC: @michaellwest

michaellwest commented 1 year ago

Workaround blogged here https://rockpapersitecore.com/2023/09/using-powershell-to-publish-to-experience-edge/

$pItem = Get-Item -Path "master:/sitecore/media library/Project/Tenant/Client/Sitemaps/sitemap"​
$db = Get-Database "experienceedge"​
$lang = [Sitecore.Globalization.Language]::Parse("en")​
[Sitecore.Publishing.PublishManager]::PublishItem($pItem, $db, $lang, $false, $false)