Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to establish communication with Looker host

Tags:

reactjs

looker

This will be very basic, I do not know how to connect to looker with my client ID and client secret for the Looker Extension SDK. This is a hello world app but the documentation is very lacking on the basics.

import React, { useContext, useEffect, useState } from 'react'
import { ComponentsProvider, Space, Text } from '@looker/components'
import { ExtensionContext } from '@looker/extension-sdk-react'


export const HelloWorld: React.FC = () => {
  const { core40SDK } = useContext(ExtensionContext)
  const [message, setMessage] = useState('')

  useEffect(() => {
    const getMe = async () => {
      try {
        const me = await core40SDK.ok(core40SDK.me())
        setMessage('Hello, '+ me.display_name)
      } catch (error) {
        console.error(error)
        setMessage('An error occurred while getting information about me!')
      }
    }
    getMe()
  }, [core40SDK])

  return (
    <ComponentsProvider>
      <Space p="xxxxxlarge" width="100%" height="50vh" around>
        <Text p="xxxxxlarge" fontSize="xxxxxlarge">
          {message}
        </Text>
      </Space>
    </ComponentsProvider>
  )
}

This results in Failed to establish communication with Looker host, but I do not know how to establish the host url or credentials

like image 904
Josh Hendrix Avatar asked Oct 15 '25 16:10

Josh Hendrix


1 Answers

When you build using the Extension Framework, Looker hosts your react application internally so you don't need to do authentication. Don't use the Extension Framework if you are not hosting your react application inside Looker itself.

If you're hosting your own application and making API calls to Looker then you should just use the Looker Embed SDK. You will need to do the authentication on your webserver using nodejs / python / ruby etc. You shouldn't do authentication from client-side javascript.

like image 96
Simon D Avatar answered Oct 17 '25 14:10

Simon D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!