function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ken KoellnerKen Koellner 

Do you think SF Sites become undebuggable because of "Authorization Required " error page?

I'm starting to reach the point where I think SF Sites can become undebuggable because on certain errors you get only the  "Authorization Required " error page.

 

I have a Sites application that has been working pretty well.  Now in one sandbox, and one sandbox only, when I hit a certain point in the application, I always get the  "Authorization Required " error page.  But, I do not believe it is because of permissions.  I believe that page is masking the real error.

 

The page works fine when I run the same scenario logged in and by starting with the .../apex/pageName URL.

 

Run via the external Sites URL, I get that error.  Something is obviously running differently when run from the public sites user but I don't have any idea how to find out.

 

I put debug logs on for the sites guest user.  Then I triggered the operation that causes the error.  I see two new logs in the Debug Log list.  The first log shows stutus success with a duration of 2,168 ms.  So, it doesn't look like there's a permissions error.  Then there's a second short log that just shows that the /apex/Unauthorized page has been served.

 

It might be that there's some sort of View State error or some other internal error but I have no way of figuring out what it is?

 

 

Ken KoellnerKen Koellner

By the way, I did add {$Site.ErrorMessage} and {!$Site.ErrorDescription} to Unathorized.page.

 

All I get is --

 

Login is required to access this URL.

 

and--

 

Login is required to access this salesforce.com URL. Please contact your administrator if you feel this is an error.

 

 

I do not think it's a permission error.  But I have no way of knowing what the real error was.

 

And, if it were a permssions error, how would I know to what?

 

admintrmpadmintrmp
Do not assume that Success actually means success. Go into the debug log and read it. You might be surprised to find something peculiar.
BritishBoyinDCBritishBoyinDC

I'm with you on this - I spent many hours trying to debug a sites problem that turned out to be a related test class that was failing, but I never found that out via the normal degug route you have described (and I also tried)

 

In the end this post helped me work it out using the 3rd approach:

When the page failed,I finally found out what the error actually was and could then fix it...

admintrmpadmintrmp
Nice link. Thanks for sharing.
Ken KoellnerKen Koellner

I checked that doc.  All good ideas but none will be a slam-dunk on this issue--

 

  1. Will look over the log some more but I don't think anything funny is going on.
  2. I normally do initial debuggin logged in anyway but in this case I don't hit the error.
  3. This techinque would require a bit of programming.  The error occurs on the four or fifth page in a session and I'd have to write code to emulate all the user action up to that point.

 

I suspect it may be something like a fatal VF error, maybe View State size.  I don't know that there is any way to detect that.

 

NewportNewport
That tgerm link is super awesome! Thanks British!