Handling Embedded Dashboard Expired Session Duration

Hello,

I’d like get some detail on how to best handle expired session duration. We are aware we can change the duration as far out as 10 hours however regardless of duration, we would like to refresh or message the user accordingly vs having the dashboard freeze as far as an end user experience.

I notice the Embedding SDK seems to be aware when this expiration occurs as we see the following entries in console. Given it seems the SDK attempts to refresh, permitting that to work would be ideal though I’m not sure if Security error is something we can get around, open to suggestions.

Alternatively, we’ve been trying to hook on to various events but cant seem to get what I assume would be an On Change Error associated w/ contentOptions or frameOptions.

Open to details / reference that may help on either front, ultimately being able to message the user such that they can take an action is totally fine, just not clear on the options we can leverage to hook into the SDK to accomplish this.

Thanks for any assistance!

Console Info

Got 401 in the ajax call. Going to refresh the page.
Could not refresh page. SecurityError: Failed to read a named property 'reload' from 'Location': Blocked a frame with origin "https://us-east-1.quicksight.aws.amazon.com" from accessing a cross-origin frame., referrer: {redacted app url}

Console Errors

POST https://us-east-1.quicksight.aws.amazon.com/embed/044ff1607433447b8271bfd5cf251ca5/api/client/log-batch?Operation=LogClientMessageBatch&mbtc=Q76bDxRMkTkaeulxKwOhUixbeKdhscsPWIWPJ%2FAdoRM%3D 401 (Unauthorized)

embedding.56862fe9333e8f94.44.js:2 Uncaught (in promise) Error
    at embedding.56862fe9333e8f94.44.js:2:136566
    at Generator.next (<anonymous>)
    at L (embedding.56862fe9333e8f94.44.js:2:135766)
    at o (embedding.56862fe9333e8f94.44.js:2:135969)
1 Like

Hello @jshafer, welcome to the QuickSight community!

What will determine if this is something that we can resolve or if it is a feature request is if the ERROR_OCCURRED event is being triggered when the session expires. That code can be found within the contentOptions section and looks like this:

                    onMessage: async (messageEvent, experienceMetadata) => {
                        switch (messageEvent.eventName) {
                            case 'CONTENT_LOADED': {
                                console.log("All visuals are loaded. The title of the document:", messageEvent.message.title);
                                break;
                            }
                            case 'ERROR_OCCURRED': {
                                console.log("Error occurred while rendering the experience. Error code:", messageEvent.message.errorCode);
                                break;
                            }
                            case 'PARAMETERS_CHANGED': {
                                console.log("Parameters changed. Changed parameters:", messageEvent.message.changedParameters);
                                break;
                            }
                            case 'SELECTED_SHEET_CHANGED': {
                                console.log("Selected sheet changed. Selected sheet:", messageEvent.message.selectedSheet);
                                break;
                            }
                            case 'SIZE_CHANGED': {
                                console.log("Size changed. New dimensions:", messageEvent.message);
                                break;
                            }
                            case 'MODAL_OPENED': {
                                window.scrollTo({
                                    top: 0 // iframe top position
                                });
                                break;
                            }
                        }

Here is the link to that full github source page as well for reference.

Are you seeing that event triggered when this happens? If so, maybe logic could be added under that specific circumstance to force a reload on the page.

Thanks @DylanM and appreciate the welcome!

I just tested to make sure I wasn’t missing anything as I did have that ERROR_OCCURRED included in the contentOptions section and while other messages seem to be firing w/ regard to contentOptions that one in particular doesn’t seem to be.

Basically my test scenario looks like this:

  • Load the page / frame ( note I see the CONTENT_LOADED message)
  • Wait for > 15m (what we have the session duration currently )
  • I do see other contentOptions messages such as MODAL_OPENED

Beyond this point while I see the messages noted prior, I don’t see the ERROR_OCCURRED.

I think leveraging this ultimately would work really well for our case. Should I open a feature request?

Thanks again!

Note: Appears to already be a feature request:

1 Like

Hello @jshafer, sorry for the delayed response on this! That is unfortunate because that trigger is definitely our path forward on this issue. I will go ahead and tag this again as a feature request to show the customer priority. Do you have any further questions on this issue? Otherwise, I can archive it for our support team.

Hi All,

How are you handling that situation? I experience the same issue that after the 15 minutes the dashboard stops to work due to the session timeout.

I could extend the session lifetime to the max 600, but it is not a valid solution since after that 600 minutes, the dashboard will stop again (Not so frequently as the 15 min but still an issue).

So I am looking for the best way to handle that situation that is not just increase the session lifetime.

Thanks.

No Further questions on this Thanks @DylanM, I do see a few (same) issues out there in the repo for this one, hoping this will bump up and if there is anything I can do, testing so on, glad to contribute.

Hi @AlexG1 we’ve temporary taken the same approach as you mentioned and extended our lifetime. We’re keeping an eye on the repo for when this message is handled as part of contentOptions and will adapt to using that once the feature is release.

Thanks again!

2 Likes

Thanks @jshafer, I am trying to figure out if there is other option since it should be a common problem unless the people are used to increase the session to high values and don’t realize it.

I was taking a look in the sdk code, and it tries to perform the reload, but then the error Blocked a frame with origin, so I am trying to understand why this Error since the auto reload when it fails could be a valid solution to not extend the session too much.

1 Like

Hello @AlexG1, from what I can tell based on your comments and attempts to accomplish this myself, there is not a work-around for this. On the embedded platforms I have helped build, we deal with the same problems. I have tagged this as a feature request and will archive the topic for our support team. Keep an eye on the What’s New page in the community to keep an eye on new features as they are released! Thank you both for your feedback and for providing useful information.