Front end App is not working properly in production

The developed frontend custom App is working fine in customer’s sandbox. It behaves inconsistently when it is moved to customer’s production environment.

Using installed front end App , I tried to update the tickets. Sometimes the App is initiated, works fine and also shows all the logs which are I embedded in my code. Sometimes the App is not initiated and also not able to get any logs too.


1 Like

Hi, Is you app contains middleware too?if Yes it may due to failure of API response, If not try to remove commented code or it may shows you in console what is going on so u may share it here.


@Priya_Dharshini Please also check if app is failing at initialization, or some other calls. For that, print your every error in the catch block.
Else please share your piece of code here so we can further help you out.



This might like have to do something to do with JS.

  1. Can you help us sharing a code snippet of JS file where app.initialized() happens?
  2. Also in the the HTML file where scripts are included. Just to notice the order in which scripts are included in the HTML.

Please feel free to remove any unnecessary code that you think might not be relevant for debugging.

I am sharing the piece of code used in my code.

$(document).ready(function () {
    .then(function (_client) {
      window.client = _client;
      console.log(headers, options);'domainName')
        .then(function (data) {
          console.log("INSIDE domain");
          window.domain = data.domainName;
      var eventCallback = function (event) {
        var event_data = event.helper.getData();
          function (data) {
            console.log("INSIDE UPDATE"); console.log(data);
            let content = data.ticket;//,j = 0;//k;, id=[]
            console.log("content......", content);
            console.log("content.custom_fields.cf_test"); console.log(content.custom_fields.cf_test);
          function (error) {
            // failure operation
      };"ticket.propertiesUpdated", eventCallback);

Please find the attachment below.

Sometimes App is initiated and throws logs too.rar (695.0 KB)


:arrow_heading_up: Can you please eloborate on what do you mean by ‘customer’s sandbox’ here? Is it local evironment running on fdk ?

As per documentation,

So, your logs added to the code are being executed when Freshservice page loads. It is not ‘sometimes’ but it is very certain that INSIDE domain will be logged to console when page loads for the first time.

To better handle this, please use next event as part of app life cycle,

For reference only, I tried to refactor the code,

document.onreadystatechange = whenInteractive;

function whenInteractive() {
  if (document.readyState == 'interactive') {
    return app
      .then(function appLogic(_client) {
        window.client = _client;
}'app.activated', observePropUpdate);

function observePropUpdate() {'domainName').then(function logDomain(payload) {
    window.domain = payload.domainName; // not encouraged to pollute global scope
  });'ticket.propertiesUpdated', seeFields);

  function seeFields(event) {
    let event_data = event.helper.getData();
      .then(function staring(data) {
        console.log('INSIDE UPDATE');
        let content = data.ticket;
        console.log('content......', content);
      .catch(function failEvent(error) {;

Please let me know if that helps.

1 Like