Hello, I'm having issues when embedding a React da...
# gooddata-ui
e
Hello, I'm having issues when embedding a React dashboard into a Rails app. I've followed the embedding guide and the integration part but received this error message. Could you please assist? What could cause the issue? Thank you very much!
i
Hi Eli, Sorry to hear about your troubles. Are you working with GoodData.CN or with GoodData Cloud, please? Also, could you be so kind and re-share the error from the console with us, please? You can simply copy-paste it as a plain text.
e
We are using Cloud.
✔️ 1
`A non-serializable value was detected in the state, in the path:
loading.error
. Value: Error: An unexpected error has occurred` AnalyticalBackendError index.js:28 UnexpectedError index.js:101 convertApiError errorHandling.js:23 node_modules analytics.js:302224 getSettingsForCurrentUser index.js:87 getSettingsForCurrentUser index.js:21 loadSettingsForCurrentUser resolveDashboardConfig.js:25 resolveUserSettings resolveDashboardConfig.js:54 Redux 16 node_modules Immutable node_modules analytics.js:351180 dispatch dashboard:1 node_modules analytics.js:348704 React 8 workLoop scheduler.development.js:266 flushWork scheduler.development.js:239 performWorkUntilDeadline scheduler.development.js:533 js scheduler.development.js:571 js scheduler.development.js:633 Webpack 11 Caused by: TypeError: (intermediate value).data.data is undefined node_modules analytics.js:307710 node_modules analytics.js:302217 getSettingsForCurrentUser index.js:87 getSettingsForCurrentUser index.js:21 loadSettingsForCurrentUser resolveDashboardConfig.js:25 resolveUserSettings resolveDashboardConfig.js:54 Redux 16 node_modules Immutable node_modules analytics.js:351180 dispatch dashboard:1 node_modules analytics.js:348704 React 8 workLoop scheduler.development.js:266 flushWork scheduler.development.js:239 performWorkUntilDeadline scheduler.development.js:533 js scheduler.development.js:571 js scheduler.development.js:633 Webpack 11 Take a look at the reducer(s) handling this action type: loadingSlice/setLoadingError. (See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state) dashboard236725
i
Thanks, please let me check internally what might be causing such an error.
👍 1
j
Hi Eli, may I kindly know how do you instantiate the backend? In case of cloud you can proceed (for example) as:
Copy code
const backend = tigerFactory({
  hostname: "<https://_______.demo.cloud.gooddata.com/>"
}).withAuthentication(new ContextDeferredAuthProvider(redirectToTigerAuthentication));
also these backend libraries are stored in @gooddata/sdk-backend-tiger package. May I see a portion of your
package.json
file that corresponds to @gooddata packages? Having these information we can troubleshoot better. Cheers, Jakub
e
Thanks, Jakub. We are using this to initialize:
const backend = tigerFactory().onHostname("<https://____.trial.cloud.gooddata.com/gdc>").withAuthentication(new ContextDeferredAuthProvider(redirectToTigerAuthentication));
i
@Jakub Vajda
j
That
/gdc
in the endpoint address seems rather suspicious to me, can you try to remove it? Also the react-components seems to be an obsolete one, however I am not aware of the context. Now you should be able to use it as follows:
Copy code
import tigerFactory, { ContextDeferredAuthProvider, redirectToTigerAuthentication } from "@gooddata/sdk-backend-tiger";
import { BackendProvider, WorkspaceProvider } from "@gooddata/sdk-ui";
import { Dashboard } from "@gooddata/sdk-ui-dashboard";
import { idRef } from "@gooddata/sdk-model";

import "@gooddata/sdk-ui-dashboard/styles/css/main.css";

const backend = tigerFactory().onHostname("<https://____.trial.cloud.gooddata.com/gdc>").withAuthentication(new ContextDeferredAuthProvider(redirectToTigerAuthentication));

const dashboard = idRef("this_hex_code_to_identify_dashboard");

...
<Dashboard dashboard={dashboard} />
Does it match with your case?
e
That's getting us further! Removing gdc helped. We now have a "No Session or Expired Session" message. We also have a number of
Copy code
XML Parsining Error: not well-formed
errors in the console. We also still have the error
Copy code
A non-serializable value was detected in the state
Here is some more context:
Copy code
import tigerFactory, { ContextDeferredAuthProvider, redirectToTigerAuthentication } from "@gooddata/sdk-backend-tiger";
import { BackendProvider, WorkspaceProvider } from "@gooddata/sdk-ui";
import { Dashboard } from "@gooddata/sdk-ui-dashboard";
import { idRef } from "@gooddata/sdk-model";
import "@gooddata/sdk-ui-dashboard/styles/css/main.css";
const backend = tigerFactory()
  .onHostname("<https://_____.trial.cloud.gooddata.com/>") // this should be the domain where the GoodData Cloud or <http://GoodData.CN|GoodData.CN> is hosted
  .withAuthentication(new ContextDeferredAuthProvider(redirectToTigerAuthentication));
const dashboard = idRef("___");
export const EmbeddedDashboard = () => <Dashboard dashboard={dashboard} />;

function App() {
    return (
      <BackendProvider backend={backend}>
          <WorkspaceProvider workspace="_____">
              <EmbeddedDashboard />
          </WorkspaceProvider>
      </BackendProvider>
    );
}
j
And if you open https://_____.trial.cloud.gooddata.com/ in another window of that browser are you logged in? It might be a problem of mismatched cookies stored in the browser memory. Also I would check if you have allowed origin for the local development server (in example https://localhost:3030). As for the
non-serializable value detected in the state
My search pointed out, this might be some specific problem related to redux-toolkit. https://stackoverflow.com/questions/61704805/getting-an-error-a-non-serializable-value-was-detected-in-the-state-when-using Are you using the toolkit? Lastly if the
@gooddata/react-components
is not used can you remove it? I am not sure what is the origin of the package as I cannot find that in the npm package registry.
e
I have verified that I am logged into gooddata in the same browser. I have removed the react-components library. CORS is properly configured for development. I am now using a different browser and and getting the message "Request Failed with Status Code 404" I am getting the error
Copy code
Tiger backend threw an error: {detail: 'The requested endpoint does not exist or you do not have permission to access it.', status: 404,
Issue resolved. Thank you for your help.
🙌 2