Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contentOptions.ERROR_OCCURRED is not trigger when dashboard url is expired #164

Open
zhangjianrencai opened this issue Aug 16, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@zhangjianrencai
Copy link

zhangjianrencai commented Aug 16, 2023

Is there a error event that fired when dashboard URL is expired? We are trying to catch the ERROR_OCCURRED when the dashboard URL is expired with 401
I am using v2 of the SDK which fires an onMessage event, but nothing is fired when the dashboard URL is expired with 401. Here is some sample code taken from the example in the docs but no changeEvent is logged in contentOptions.

import { useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
const QuickSightEmbedding = require("amazon-quicksight-embedding-sdk");

const QuickSightReport = () => {
  useEffect(() => {
    const initLoad = async () => {
      const embeddingContext = await QuickSightEmbedding.createEmbeddingContext();

      const { embedDashboard } = embeddingContext;
      var containerDiv = document.getElementById("embeddingContainer");
      console.log('xxxx', containerDiv)
      if (containerDiv) {
        containerDiv.innerHTML = "";
      }

      const frameOptions = {
        url: "<YOUR DASHBOARD URL>",
        container: containerDiv,
        height: "700px",
        width: "300px",
        onChange: (changeEvent: any, metadata: any) => {
          if (changeEvent.eventLevel === "ERROR") {
            console.log(
              `Do something when embedding experience failed with "${changeEvent.eventName}"`
            );
            return;
          }
          switch (changeEvent.eventName) {
            case "FRAME_MOUNTED": {
              console.log("Do something when the experience frame is mounted.");
              break;
            }
            case "FRAME_LOADED": {
              console.log("Do something when the experience frame is loaded.");
              break;
            }
          }
        },
      };
      const contentOptions = {
        onMessage: async (messageEvent: any, experienceMetadata: any) => {
          console.log('vxsdfsdf')
          switch (messageEvent.eventName) {
            case "CONTENT_LOADED": {
              console.log(
                "Do something when the embedded experience is fully loaded."
              );
              break;
            }
            case "ERROR_OCCURRED": {
              console.log(
                "Do something when the embedded experience fails loading."
              );
              break;
            }
            //...
          }
        },
      };

      // Embedding a dashboard experience
      const embeddedDashboardExperience = await embedDashboard(
        frameOptions,
        contentOptions
      );
    };

    initLoad();
  }, []);

  return (
    <>
      <div className="customer-page reportBox">
        <div id="embeddingContainer"></div>
      </div>
    </>
  );
};

export default QuickSightReport;
@zhangjianrencai zhangjianrencai changed the title ERROR_OCCURRED is not trigger when dashboard url is expired contentOptions.ERROR_OCCURRED is not trigger when dashboard url is expired Aug 16, 2023
@sonals-amazon
Copy link

Hello, It is correct that no event will be triggerred when the url expires. We have recorded this as a feature enhancement request on our end.

@sonals-amazon sonals-amazon added the enhancement New feature or request label Dec 5, 2023
@brianwyka
Copy link

This is a must have.

@alexcoimbra12
Copy link

Hi All,

I am facing the same issue, how are you handling the situation of the session expires?

For example, I have a dashboard and my SessionLifetimeInMinutes is 15 minutes, after that 15 minutes any action that I perform in the dashboard doesn't work, and it stays loading forever, unless I refresh the page to generate the URL and the 15 minutes session again.

I can extend the session lifetime, but the problem is still there after it reaches the max session lifetime and the user will see the frozen screen and will have to refresh the page, which is not a good user experience. What I want is to automatically reload the dashboard when it expires, but without the event being fired I don't see many options. How are you handling that behavior other than just extend the lifetime, while that enhancement is not in place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants