+ Start a Discussion
dshpadshpa 

Intermittent Authorization Required Page (401) without any errors

Hi all!

 

I have a strange and annoying problem with my Force.com site. There is a start page where a user can press a button and pass to another page. From time to time after pressing the button the page refreshes about 1 or 2 minutes and then Authorization Required Page appears. There is no errors in the method for this button because all code is enclosed in try/catch block, so user must see a message if an exceptions is thrown. Of course I try this in debug mode. The problem is this issue is unpredictable and takes place not very often so it's hard to reproduce it. But one time I managed to do this and didn't see any additional messages in Authorization Required Page. May be someone has an idea how to find out what's wrong? I don't know what to do if I don't have any error messages to clarify the situation. Any help will be appreciated.

Ankit AroraAnkit Arora

This is really strange and hope salesforce Admins can help you over this.

 

 

Thanks
Ankit Arora

 

sjain1.2523113033806995E12sjain1.2523113033806995E12

have you tried your code internally, may be there is an error on VF page related with syntax error.Make sure you have included the VF Pages in sites.check all permission in site setting you have provided to custom objects of your concern.

Shashikant SharmaShashikant Sharma

It is very hard to predict anything without seeing your VFP and Controller Class for VFP. It might be possible Guest profiles rights on any object's you are accesing in your controller class got changed at the time you could reproduce it. Please provide your VFP and Controller's code.

dshpadshpa

Thanks to all. Eventually I've commented some code and the issue practically stopped. Practically because I get notifications about the problem but very-very seldom. I'll continue to research the situation. To post the code here isn't a good idea because it's distributed over some classes and it's not very easy to look through many lines of it it on the forum. Besides I've already written that there is no errors in syntax or run-time errors, all code in the problem method is inside a try/catch block. I'm experienced enough to exclude such simple causes.

 

The most probable explanation for me now is the following. Sometimes the execution time for the problem method exceeds a limitation and SF shows page 401. Execution time depends on many factors so the issue is quite unpredictable. I've found this governor limit in docs:

 

Default timeout of callouts (HTTP requests or Web services calls) in a request 10 seconds

 

So after reducing the code it doesn't exceed this limitation. Can this be the cause of the issue? Did anybody encounter anything like this?

sgurumurthysgurumurthy

I think that's what it is because I am getting the same strange Authorization required error intermittently. I am doing some more tests to confirm the hypothesis. Will confirm the results here. 

sgurumurthysgurumurthy

Turns out that my issue was linked to the new Apex JSON Parser not being able to consistently locate the Apex class to deserialize JSON content into.