forcedotcom / SalesforceMobileSDK-Android

Android SDK for Salesforce

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Hybrid (Visualforce) app crashes upon startup due to timeout in fontdoor.jsp login dance

daveespo opened this issue · comments

Please fill out the following details:

  1. Version of Mobile SDK Used: 10.0.2
  2. Issue found in Native App or Hybrid App: Hybrid
  3. OS Version: Android 11
  4. Device: Samsung Tab A
  5. Steps to reproduce: Launch the app and complete the Salesforce login -- accept the Connected App authorization screen
  6. Actual behavior: Popup modal that said:
Application Error - The connection to the server was unsuccessful

https://ptqa1925.my.salesforce.com/secur/frontdoor.jsp?&sid=***

Expected Behavior: Expected to log in and land at the Visualforce page defined in bootconfig
10. Error Log: CordovaWebView: TIMEOUT ERROR!

I redacted the URL above due to it containing a sensitive session ID.

I was able to take the URL that is identified in the error message above (the whole thing with the Session ID and retURL) and load it in a regular web browser on a PC and saw that the redirect through contentDoor was taking 20 seconds:

image

The default timeout for CordovaWebViewImpl is 20 seconds so the 20+ second wait on the contentDoor was causing the timeout during app launch.

Note This only happens in some orgs. I could not repro in DE orgs. I could only repro in EE orgs. All orgs have Enhanced Domains enabled so I was unable to find an obvious explanation in Setup to explain why I saw different timings for the login dance.

Workaround:

You can define a preference in config.xml to increase the timeout:

<preference name="LoadUrlTimeoutValue" value="60000" />

Given the erratic timing of the login dance, can you increase the default timeout in CordovaWebViewImpl line 148 to 60 seconds?

Hi @daveespo, globally increasing the timeout would need some consideration before we decide to go that route. Is this issue consistently reproducible for certain Orgs across multiple networks (solid WiFi, cellular, etc.)? If we can narrow down the issue to specific Orgs, there may be a solution with configuration for those Orgs.

EDIT: Also, just to clarify, CordovaWebViewImpl is provided by the Cordova Android library, and so we have no control over that particular source.

@gkotula -- I had multiple end users report the same behavior across different orgs so it can't be correlated to local connectivity. Additionally, the screenshot I pasted above was from a wired gigabit connection from a conventional web browser (Chrome) -- so this is definitely on the Salesforce server side.

At the same time where EE orgs were exhibiting this problem, the DE orgs that I was using for development were NOT exhibiting the same problem. All orgs had Enhanced Domains enabled and deployed. I spent a fair amount of time trying to reason about what the configuration difference could be between the DE and EE orgs but couldn't come up with anything.

I appreciate that you can't modify CordovaWebViewImpl but you could add the LoadUrlTimeoutValue to the boilerplate config.xml that is generated when generating a new app template. Also, I have to say that for Salesforce and Visualforce, in particular, 20 seconds is unfortunately a rather short timeout. A "cold" Visualforce page can take up to 30 seconds to compile and render server-side.

Like I said, I have my workaround in place and I'm hoping that others that encounter the same thing provide support for getting the timeout increased to avoid future frustration of app crashes in the field.

@daveespo Thank you for your thoroughness! You make an interesting point about the "cold" Visualforce page, and I've passed this suggestion to the team for further evaluation of the proposed change. In the meantime, just to be sure you are unblocked, your timeout override has addressed the original issue correct?

Correct, I have a reasonable workaround at this time.

Good to hear. For now, I've added the enhancement label, and we have this proposal tracked in our internal ticketing system. Thank you for the suggestion!

@daveespo I'm connecting some dots here, and you are not the only one who has recently had issues with the performance of that endpoint... Could you verify whether all the problematic Orgs have been upgraded to Spring '23 release?

All orgs have been upgraded to Spring '23 so that wouldn't explain the difference between the orgs I've tested with.

Also to note, an interactive login to these orgs (username/password in a desktop browser) is speedy and there is no delay in the login dance greater than 1-2 seconds. It seems to be unique to the login dance using the session ID.

@daveespo Could you share what products the problematic Orgs are subscribed to? Marketing, Commerce, etc.? Knowing how your Orgs are configured may help expedite the solution.

They are just plain vanilla Trial EEs that have Sales cloud only.

Closing this issue as it is a duplicate of forcedotcom/SalesforceMobileSDK-iOS-Hybrid#208
We are looking into moving away from frontdoor when loading the remote page in an hybrid remote app. We will update on the other issue.

@wmathurin -- you closed this issue by referencing the same issue as a duplicate :-) What issue did you intend to reference with your prior comment?

Good catch - I updated the earlier comment with the correct link.