I'm attempting to follow the documentation for SXA in a CI/CD process.
Configuration Details:
- Sitecore 9.1 (Standalone Config - My Local Dev)
- SXA 1.8 initial release
- PowerShell 5
- Running on Windows Server 2016 Standard Edition
Per the documentation, I created my own Web API endpoints in my Project folder of the PowerShell Scripts. I copied the scripts for import and export into my respective copies of the script items.
When I called the web API endpoint using the following path:
/-/script/v2/master/site-export-script
I received the following response:
> Exception calling "Run" with "2" argument(s): "startIndex cannot be larger than length of string. Parameter name: startIndex" At line:135 char:9 + [Sitecore.Pipelines.CorePipeline]::Run("ceExport.export", $ex ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentOutOfRangeException
This is the Cmdlet from the Get-CreativeExchangeExportResponse
Function Path:
/sitecore/system/Modules/PowerShell/Script Library/SXA/SXA - Creative Exchange/Functions/CI/Get-CreativeExchangeExportResponse
[Sitecore.Pipelines.CorePipeline]::Run("ceExport.export", $exportArgs);
I'm adding this in hopes someone can help speed my research up. Thanks in advance.
Update: 6/24/2019
This is the script file that is run and give the exception below:
Import-Function Get-CreativeExchangeExportResponse
$item = Get-Item -Path "/sitecore/content/Tenant/Site/Home"
$exportArgs = Get-CreativeExchangeExportResponse -CurrentItem $item -DeviceId "{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}"
$responseObject = @{
"Messages" = $exportArgs.Messages;
"Result" = $exportArgs.CreativeExchangeExportStorage.GetResult()
}
Set-HostProperty -HostWidth 9999
[Newtonsoft.Json.JsonConvert]::SerializeObject($responseObject)
Running this code in the PowerShell ISE for Sitecore still produces the following stack trace:
New-Object : Exception calling ".ctor" with "0" argument(s): "Object reference not set to an instance of an object." At line:115 char:39 + ... ntextData = New-Object -TypeName "Sitecore.XA.Feature.CreativeExchang ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand You cannot call a method on a null-valued expression. At line:2 char:5 + $websitePath = [System.Web.HttpContext]::Current.Server.MapPath(" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Set-Content : Cannot find path 'master:\CE_auth_c4464daa-f673-4505-81d7-62f3940748fc-2019-06-24T13.55.16.8315406-05.00.aspx' because it does not exist. At line:16 char:5 + Set-Content -Value $loginString -Path $filePath + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (master:\CE_auth...5406-05.00.aspx:String) [Set-Content], IOException + FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.SetContentCommand Send-AuthenticationRequest : An Error occured during authentication. Please clean all authentication data At line:116 char:23 + ... $exportArgs = Send-AuthenticationRequest $exportArgs $UserName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Send-AuthenticationRequest System.Collections.DictionaryEntry System.Collections.DictionaryEntry You cannot call a method on a null-valued expression. At line:42 char:9 + $websitePath = [System.Web.HttpContext]::Current.Server.MapPa ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "GetCookies" with "1" argument(s): "This operation is not supported for a relative URI." At line:45 char:5 + $s.Cookies.GetCookies($Uri) | % { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException Exception calling "Run" with "2" argument(s): "Object reference not set to an instance of an object." At line:135 char:9 + [Sitecore.Pipelines.CorePipeline]::Run("ceExport.export", $ex ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : NullReferenceException {"Result":{"Result":" /App_Data/packages/CreativeExchange\\FileStorage\\Site","Type":2},"Messages":[]}