Inconsistent VisualForce page error when using multiple communities

  • 2
  • Problem
  • Updated 4 years ago
We have been using Skuid with Salesforce Communities for a year or so now, quite successfully.  We are now deploying two new Salesforce Communities, and are now encountering an odd, inconsistent behavior (though thankfully it is 100% reproducable).

If you go navigate to one of the two new communities directly from Salesforce (using the menu on the upper left), you get a VisualForce error.  But if you first go to our original community, and then navigate to the new communities, it works perfectly. 

I'll try to describe this both in text/images as well as a video of the problem hoping that somebody can help figure this one out!

I'm logged in as a Salesforce Administrator ... and since the pages do work when accessed in the correct order, I'm doubtful this is a permissions problem but with Salesforce you never know for sure...!  But as you will see, the fact that it always works for one community and is inconsistent for the others makes me wonder if this is still a permissions/community configuration problem, but for the life of me I can't find the difference between them!

So here goes ... if I first navigate to my original community (Unidesk Customer Success), as in....



I get that page perfectly (this always works)...



If I then use that same menu and navigate to my new Learning Community, this works perfectly as well (showing that the page loads, works and has valid permissions):




If I then return to the Internal site, I get a hint of a problem in that I don't return to the Skuid Pages page, but instead get an error (and there is no skuid variable defined) and I'm on the Home tab instead of Page (likely a side effect of the error). 



If I then click on Pages, it loads just fine ... but do note that the URL is the same page but a different domain:



Now if I go directly to the new Learning community, I get the error:



If I repeat the above - go to Internal, click Pages, go to Success community and then to Learning, it all works fine.

Also of potential interest is that even when I'm getting the VF error, if I navigate to the tab directly (not via the community), it always works fine.  Again, the only difference of significance appears to be the domain name:



Below is a video showing this all live, which might help put it all into context:




I also enabled the SFDC Debugger on this user, and here is the debug log for the error.  Note that while there is an odd error code in the summary ("Salesforce System Error: 472535200-1330485 (-921938118) (-921938118)") there is no indication of an error in the actual log itself.




I've gone ahead and granted access to Skuidify to our instance if that is helpful.

Thanks in advance for any advice or guidance!

- Chris
Photo of Chris

Chris

  • 1,632 Points 1k badge 2x thumb

Posted 4 years ago

  • 2
Photo of Chris

Chris

  • 1,632 Points 1k badge 2x thumb
Oh ... and I forgot to mention, I've tried setting up the VisualForce page both as a direct load of the page, and through the Page Assignment redirects.  No different in behavior either way.  Here is the current version of the Learning Center tab VisualForce page that is using Page Assignments...

<apex:page standardController="Learning_Series__c" recordsetvar="l" 
         extensions="skuid.Redirects" showChat="true" 
         docType="html-5.0" readonly="true"
         showheader="true" sidebar="false"
         action="{!IF(canUseSkuid,'',redirect)}"
         title="{!$ObjectType.Learning_Series__c.labelPlural}">
    <skuid:page actiontype="Tab" objecttype="Learning_Series__c"/>
</apex:page>
Photo of Chris

Chris

  • 1,632 Points 1k badge 2x thumb
* bump *

Any thoughts on how to debug why the VisualForce page is returning an error?  All I can tell from the logs is that a couple Skuid SOQL calls are made - so at least some of the Skuid code is running, and I don't see how my code can cause this failure (though maybe my configuration can?)  

Thanks...

- Chris
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Chris, I'm pretty stumped on this one. Seems like there's 2 separate issues, which may need to be treated separately, but they may be related.

I think you should log the first one as something like "Switching communities incorrectly sends user to local rather than namespaced Visualforce Page" --- Salesforce's Community switching Servlet is definitely generating the wrong URL (unidesk--c.na5.visual.force.com rather than unidesk--skuid.na5.visual.force.com), this is not a Skuid issue.

And you should definitely log a case about the 2nd issue, with the VF page not loading, to get Salesforce to give you the internal Gack description of the error message you're receiving: Salesforce System Error: 472535200-1330485 (-921938118) (-921938118). Sometimes the internal error messages help provide a clue to what's going wrong --- sometimes they don't. 

Hope that helps!
Photo of Chris

Chris

  • 1,632 Points 1k badge 2x thumb
Thanks for looking at it Zach.  I've spent some more time trying to get ready to submit to Salesforce for support where I could show that it has nothing to do with Skuid, but I seem unable to do this.  Simply by changing the Page to use standard VF code, it works just fine.  No more errors.

But if the page has the Skuid code (for direct page load, or page load via page assignment) I get the error.  And all my communites show this failure, not just by new ones (as I originally thought) - though it is more obvious now with the "generic" VF code as those pages load fine, and when I switch to the original community page I now get the failure.

This makes it hard to show to Salesforce that this isn't a Skuid problem.  Any ideas how I might reproduce a failure that doesn't involve Skuid?

Do note that we see the SOQL statements accessing Skuid tables in the debug log, prior to the error, so we know that some of the code must be running.  So I wonder if maybe this is some interaction still between Skuid and communities / community switching?

Thanks!

- Chris
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Chris, in my testing in your org, I have had the Community switching fail and throw (variously) Internal Server Errors or the Force.com Sites error page --- even when the VF page is just your simple "Hello world" example.

I think that the root error has to do with how Salesforce Communities are (a) storing / remembering the last tab / URL a user was on in a particular Community, and then returning to that tab when you return to that Community (b) switching between VF pages different namespaces, which is where Skuid comes in to play, in the sense that Skuid is distributed as a managed package, which has a namespace, and so any time you go to a VF page included with Skuid the URLs have to switch into a different domain in order to correctly resolve --- and something in here is not working correctly, as your examples show above, where the URL goes to unidesk--c.na5.visual.force.com rather than unidesk--skuid.na5.visual.force.com --- it may be that the Community URL rememberer is not correctly storing the right Domain of the user's last tab. I'm not sure, but I think that this is enough to go on for sending the error report to Salesforce.