ReferenceError: app is not defined when initializing Freshdesk Frontend app

Hi everyone,

I’m trying to create a frontend app for Freshdesk using the Freshworks framework. I followed the standard setup, but when I run my app, I sometimes get the following error in the console:

ReferenceError: app is not defined

Screenshot (48)
This happens when I call:

app.initialized().then(function(_client) {
    // My code });

As a result, my app doesn’t run at all.

  1. Why app Is it sometimes not recognized?

  2. How to properly initialize a Freshdesk app so this error doesn’t occur.

Hi @TAMIL

Can you please include the script below in your HTML body


<script async src="{{{appclient}}}"></script>

Initialize the client by using the code below

document.onreadystatechange = async () => {
  if (document.readyState === "complete") {
    client = await app.initialized();
  }
};

I hope it resolves your issue

Hi @Arokiya Kithiyon A

Thanks for sharing the snippet. I’ve updated my app as per the latest docs:

I added the app client Script.

Initialized the app based on the latest Doc

But I didn’t use document.onreadystatechange. In the latest docs, the app init isn’t shown that way, so I just included the initialization part only

Hey @TAMIL

The same issue has been discussed in another thread. Please refer to the following link: "app is not defined" Error in Sidebar App.
If the problem persists, kindly let me know.