Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitecore 10.2 - Type initializer exception when executing script via WebAPI #1318

Open
larionovadaria opened this issue Nov 28, 2023 · 4 comments

Comments

@larionovadaria
Copy link

Expected Behavior

restfulv2 service works as expected right after deployment.

Actual Behavior

Similar to: #982

  • Couldn't reproduce locally, only on Azure.
  • Fix described here Sitecore 9 - Type initializer exception when executing script via WebAPI  #982 (comment) didn't help, but the issue completely disappears if you manually restart WebApp once again after deployment, which makes me think something happens during initialization.
  • Issue began to happen only after remoting restfulv2 service was enabled. Sitecore Powershell itself worked without any issues on current version and previous ones.

Setup

Sitecore PowerShell Extensions 6.3.0.17327
Sitecore 10.2
Azure WebApp hosting

Steps to Reproduce the Problem

Steps to reproduce are similar to: #982

@michaellwest
Copy link
Member

Is there something you're using with that endpoint that could be shifted over to the SPE Remoting endpoint?

@larionovadaria
Copy link
Author

I think technically we could use SPE Remoting, but chose WebAPI instead to restrict running any script, and run only ones that we have predefined.
Are you saying that we need to try to move to SPE Remoting and see if issue persists?

@michaellwest
Copy link
Member

I'm curious if running the scripts through SPE Remoting encounters the same initialization error.

Can you try something like this with SPE Remoting (and restfulv2 disabled)?

Import-Module -Name SPE
$session = New-ScriptSession -Username admin -Password b -ConnectionUri https://remotesitecore
Invoke-RemoteScript -Session $session -ScriptBlock {
        # Your script
        # or Get-Item -Path "your-script" | Invoke-Script
}
Stop-ScriptSession -Session $session

@larionovadaria
Copy link
Author

The issue I described happens from time to time after deployment, locally it was never a problem.
I'll try to do what you proposed, will monitor WebApp for a while and return back. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants