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

EmbedClient<LookerEmbedDashboard>.connect() never resolves #63

Open
ad250573 opened this issue Jan 28, 2021 · 14 comments
Open

EmbedClient<LookerEmbedDashboard>.connect() never resolves #63

ad250573 opened this issue Jan 28, 2021 · 14 comments

Comments

@ad250573
Copy link

ad250573 commented Jan 28, 2021

Upon using the embed SDK to build a dashboard, using the same method as stated in the README:

LookerEmbedSDK.createDashboardWithId(11)
  .appendTo('#dashboard')
  .on('dashboard:run:start',
      () => updateState('#dashboard-state', 'Running')
  )
  .on('dashboard:run:complete',
      () => updateState('#dashboard-state', 'Done')
  )
  .build()
  .connect()
  .then(setupDashboard)
  .catch((error: Error) => {
    console.error('An unexpected error occurred', error)
  })

the connect callback never resolves. Following the same type of example for Looks (createLookWithId()), I have no issue with the connect resolving. The dashboard does successfully embed, but no "on()" callbacks are triggered which I have come to believe that is due to the connect not resolving.

Is there something I'm missing? I believe I've eliminated any Looker specific configuration problem as I am able to successfully use the createLookWithId() method.

Looker 7.20.41
@looker/embed-sdk 1.4.0

@Vitaliy-Svinchyak
Copy link

The same for createDashboardWithUrl

@brettjonesdev
Copy link
Contributor

I had this issue recently and realized I had called the wrong URL in my LookerEmbedSDK.init(authUrlHost, authUrlHost + '/auth'). What I should have done was LookerEmbedSDK.init('acme.cloud.looker.com', authUrlHost + '/auth'). Idk if that's what you're facing but I saw the exact same symptom.

@harshmehta1
Copy link

I'm facing this issue, but only with createDashboardWithUrl and not createDashboardWithId. The 'then' and 'finally' blocks are never triggered when using 'createDashboardWithUrl'. Any suggestions on how to solve this?

@mohed
Copy link

mohed commented May 23, 2021

Any updates on this. I'm experiencing the same issue. The connect() call never resolves. I'm using the createDashboardWithId() call.

@mohed
Copy link

mohed commented May 27, 2021

I can confirm that I as well had a problem with the LookerEmbedSDK.ini() call. I didn't send in a valid URL. Once I fixed that the rest worked fine.

@joeyorlando
Copy link

joeyorlando commented Jul 9, 2021

running into this same problem:

LookerEmbedSDK.init('<our_subdomain>.looker.com');

const embedDashboard = await LookerEmbedSDK.createDashboardWithUrl(mySignedUrlFromTheServer)
    .appendTo(embedContainer.current)
    .withClassName('w-full', 'h-full')
    .withNext()
    .build()
    .connect();

console.log('this will never get printed because `connect` hangs');

As others have mentioned, the dashboard renders fine but connect never resolves.

In our case we need for connect to resolve because we need access to the LookerEmbedDashboard object returned by that promise in order to be able to send events into the iframe (ex. updating a filter from outside the iframe).

I've tested this on both 1.6.0 and 1.5.0 and still running into this unfortunately 😞

@whscullin @bryans99 any thoughts?

@joeyorlando
Copy link

joeyorlando commented Jul 9, 2021

ended up resolving this. Was a different, super-cryptic issue in my case. I'm using the createDashboardWithUrl method with a signed URL that is generated by our server.

return createSignedEmbedUrl({
    external_user_id: 'some_id',
    first_name: '',
    last_name: '',
    group_ids: [],
    external_group_id: '',
    permissions: [],
    models: [],
    access_filters: {},
    user_attributes: {},
    session_length: 3600,
    embed_url: `/embed/dashboards-next/${dashboardId}?embed_domain=${LOOKER_EMBED_DOMAIN}&sdk=2`,
    force_logout_login: false,
  });

The LOOKER_EMBED_DOMAIN must match exactly the hostname of where the embed is being displayed. In my case I was communicating with a development environment version of our backend and displaying the iframe via localhost.

Seems like strange behavior as things render fine in the iframe. Should maybe throw some sort of warning in the console?

@HeyParkerJ
Copy link

ended up resolving this. Was a different, super-cryptic issue in my case. I'm using the createDashboardWithUrl method with a signed URL that is generated by our server.

return createSignedEmbedUrl({
    external_user_id: 'some_id',
    first_name: '',
    last_name: '',
    group_ids: [],
    external_group_id: '',
    permissions: [],
    models: [],
    access_filters: {},
    user_attributes: {},
    session_length: 3600,
    embed_url: `/embed/dashboards-next/${dashboardId}?embed_domain=${LOOKER_EMBED_DOMAIN}&sdk=2`,
    force_logout_login: false,
  });

The LOOKER_EMBED_DOMAIN must match exactly the hostname of where the embed is being displayed. In my case I was communicating with a development environment version of our backend and displaying the iframe via localhost.

Seems like strange behavior as things render fine in the iframe. Should maybe throw some sort of warning in the console?

@joeyorlando what did you have to alter your LOOKER_EMBED_DOMAIN to? I've been fiddling with my own setup for quite some time and my embed domain of http://localhost:8080 is getting this to work, nor any other permutation I can think of. Thanks!

@HeyParkerJ
Copy link

HeyParkerJ commented Mar 4, 2022

After about 3 straight hours of debugging through the source code, I found that I was able to get the connect() promise to resolve by adding .withApiHost('https://dev-looker.myorg.org') to the chain. There is some code in this repo that checks for equality on this value, and in its absence tries to compare https://undefined to https://dev-looker.myorg.org, which leads the promise to never resolve.

That value will be dependent on the location of your actual Looker instance.

@gabgagnon
Copy link

gabgagnon commented Mar 18, 2022

Hey guys!
Don't forget to add '&sdk=2' at the end of your target_url property in the body. It was the cause of the never ending promise on our side.

https://docs.looker.com/reference/embedding/sso-embed:
If you are using the Embed SDK be sure to add the embed_domain and also include sdk=2 to the end of the embed URL

@SajeelHassan
Copy link

I had the same issue because I had a port number :9999 at the end of my host URL in LookerEmbedSDK.init function.
I removed the port number and it got resolved. 🎉

@williamtsoi1
Copy link

After about 3 straight hours of debugging through the source code, I found that I was able to get the connect() promise to resolve by adding .withApiHost('https://dev-looker.myorg.org') to the chain. There is some code in this repo that checks for equality on this value, and in its absence tries to compare https://undefined to https://dev-looker.myorg.org, which leads the promise to never resolve.

That value will be dependent on the location of your actual Looker instance.

I had this exact same issue. Your comment helped me resolve this. Thanks!

@sajeeldigitali
Copy link

It worked for me after removing :9999 from the end of the host URL ( yourCompany.looker.com:9999 )

@TomerPinto1986
Copy link

TomerPinto1986 commented Oct 23, 2024

After about 3 straight hours of debugging through the source code, I found that I was able to get the connect() promise to resolve by adding .withApiHost('https://dev-looker.myorg.org') to the chain. There is some code in this repo that checks for equality on this value, and in its absence tries to compare https://undefined to https://dev-looker.myorg.org, which leads the promise to never resolve.

That value will be dependent on the location of your actual Looker instance.

@HeyParkerJ
hello
I am using signed embed url using looker api to create one from my server side
i am adding to to the embed url embed domain with sdk=2
and as you suggested here i am using .withApiHost() method but still cant resolve the connect() promise.
can you direct me to the place you debug the looker source code?
thanks

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

No branches or pull requests