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
apexsutherlandapexsutherland 

Catching Visualforce Errors in Force.com Sites - frustrated

I'm incredibly frustrated trying to figure out how to catch and troubleshoot Visualforce errors on a page exposed through Force.com Sites (unauthenticated guest users only). I've gotten several suggestions on what to try from other folks in the community and I've tried the following:

 

 

  • adding <apex:pageMessages> to my Visualforce page - this is fine for displaying sObject validation errors prior to insert/update, but doesn't surface Visualforce errors to Force.com Sites guest users
  • adding {!$Site.ErrorMessage} & {!$Site.ErrorDescription} to a separate Visualforce Page and setting that as the Error page for the Force.com site. This doesn't seem to help/work, as the error page is never displayed to unauthenticated users.
  • adding <site:previewAsAdmin> to my Visualforce pages and clicking the "Preview As Admin" link on the Sites detail page. This never seems to display the error on the page either. Honestly I can't figure out what this feature is actually supposed to provide, the documentation is pretty nebulous and the behavior of the feature is an enigma.
In my situation users are getting errors very intermittently, and by the time we hear about it we have no idea what the precise conditions were which caused the error, so we have no way of reproducing it. Debug logs don't help us because they don't seem to capture Visualforce errors (which is what I suspect the users are getting), only errors in the actual Apex code.
I sincerely hope that I'm just misunderstanding how to go about troubleshooting these issues, but I fear that there is a big gap in the troubleshooting capabilities of Force.com Sites. Can anyone give me some better guidance on how to approach this?

 

apexsutherlandapexsutherland

If surfacing errors to unauthenicated users is non-negotiable, can you at least email us every time there is a Visualforce rendering error? Why isn't this the case already?

Pradeep_NavatarPradeep_Navatar

Sometimes actual error comes on the site contact email. To setup the site contact : Go to site detail Page -> Site Contact-> select the user from lookup.

 

Run the application again after setting up the Site Contact and see whether error comes on the email of the site contact.

apexsutherlandapexsutherland

Not in this case (and not in the several testing scenarios that I've tried where I purposefully FORCED an error to occur). We've had the Site Contact set up all along, and have not received any error e-mails.

joshbirkjoshbirk

Been there - don't think there's a silver bullet solution to it.  Probably too obvious, but I've often had to chase down the situation as a authenticated user to get real trouble shooting.  If it's a scenario where only guest users are having a problem, it's typically a profile / access issue - though if it's intermittent than that might not be the case.

Ken KoellnerKen Koellner

I had problems with getting the Authentication Required page in Sites also.  It seems whenever you get an uncoverable error, you get that.  Maybe it's a few state problem.  I've also found it to be intermittant so maybe view state is varying intermittanly do to some unknown cause.

 

The thing is, when you get that Authenication Required error, you can no info and there's nothing in the log.  That makes Sites application virtually undebuggable is some cases.

 

I really think SF has to fix this issue or sites is NOT a plaform to consider using for customer-facing web applications.