It’s been a few days since my colleague had run into the error below with the Power Apps Portals:
From the stacktrace, we can probably guess that the problem is related to the permissions somehow:
And, yes, this issues started to happen once an Administrator web role had been deleted. That did not happen intentionally – it was a mistake, but the end result is that a portal administrator was getting this error pretty much anywhere on the portal if they were logged in.
So, I figured I’d sacrifice my own portal for the experiment, and, it seems, this is what eventually helped. Even though in a somewhat unexpected way…
Once I had no Administrator role, I did not start to see the error above right away. Instead, I saw a custom error page (which is portal default for error message). So, I had to go to the portal admin area, disable custom error page (as per the instructions here: https://docs.microsoft.com/en-us/powerapps/maker/portals/admin/view-portal-error-log#display-a-custom-error-message), and, then, I figured I should also restart the portal to clean up any cache… Once back in the portal, I did not see any errors at all – it was working flawlessly (of course I did not have admin permissions anymore, but I was not experiencing any errors either).
This is when my colleague had an “aha” moment, it seems, since, while observing me doing all that, he figured he should try to restart the portal as well. And, just like that, the error was gone.
You can try it for yourself (if you are not afraid of having to restore “Administrator” role):
- Login to the portal under a user account that has “Administrator” web role
- Go to the Portal Management
- Delete “Administrator” web role
- Logout from the portal
- Login under the same user account again, click through a few pages. It may not happen right away, but, after just a little while, you will likely run into the same error above (Contact-Us seems to be more vulnerable to this than other pages, though. On some other pages, you might just see “liquid error” messages instead)
- Then go to the portal admin portal, restart the portal, and the error will be gone
And, as it often happens, this is not necessarily new, though this is new to me. I guess this is just a specific example of what Colin Vermander blogged about back in 2019: https://colinvermander.wordpress.com/2019/09/18/powerapps-portal-force-restart/
PS. In order to get things back on track, create a new Administrator role, add required web site access permissions, entity permissions, etc. Assign that role to the user and restart the portal again. Things should be back to normal after that.