Situation
I'm trying to use the SPE Web API to call a simple script to publish 1 single item from gulp (in SXA Theme). The script URL call looks like this:
/-/script/v2/master/PublishItem?user=mypersonaluser&password=xxx&itemPath=/sitecore/media library/Themes/Portal/sass/main
Problem
When the call executes I receive a 500 error response with the following stacktrace:
15648 2018:04:13 16:46:48 ERROR Application error.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: mscorlib
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Cognifide.PowerShell.Core.Settings.Authorization.ServiceAuthorizationManager.GetServiceAuthorizationInfo(String serviceName)
at Cognifide.PowerShell.Core.Settings.Authorization.ServiceAuthorizationManager.IsUserAuthorized(String serviceName, String userName)
at Cognifide.PowerShell.Console.Services.RemoteScriptCall.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Observations
On request of Adam I already checked my showconfig.aspx and the section for my restfulv2 looks like this:
<restfulv2 requireSecureConnection="false" patch:source="Gulp.config" enabled="true">
<authorization>
<add Permission="Allow" IdentityType="Role" Identity="sitecore\PowerShell Extensions Remoting"/>
<add name="AdminRule" Permission="Allow" IdentityType="Role" Identity="sitecore\IsAdministrator" patch:source="Gulp.config"/>
<!--add Permission="Allow" IdentityType="User" Identity="extranet\Anonymous" /-->
<add Permission="Allow" IdentityType="User" Identity="sitecore\admin"/>
</authorization>
</restfulv2>
Additionally this only shows up on the first call
Question
Why am I receiving this exception?