Serverless methods - Not getting triggered

Hi,

Since yesterday, we face an outage in the Freshdesk product. All the serverless methods like onConversationCreate,
onTicketUpdate, onAppInstall, etc. are not getting triggered in the custom app.

Also, we deployed a sample serverless app and tried to install it but couldn’t. Please refer to the below screenshot for reference

Could you please check this and fix it ASAP?

2 Likes

@rajezz - We are assuming this could be solved by enabling newer version of Freshdesk app management page. Can I proceed by enabling it for spritlesoftware.freshdesk.com domain?

2 Likes

I’m curious about knowing the Freshdesk app management page. Could you please elaborate on what it is and how it can resolve the issue?

1 Like

Thanks for asking.

It’s the page where Freshdesk Admin can manage the apps. To install, uninstall apps from marketplace and developer app submission page. Currently, there is a newer version of this page where serverless events like onAppInstall are better handled and also would be helpful to easy debug any problems specific to current account.

This newer version is available for all the developers who build apps on trail accounts.

I am not sure, if this is already enabled for the above mentioned Freshdesk account. But we can check and upgrade it.

1 Like

@Saif

Thanks for the explanation!

Yes, please proceed with enabling the newer version of the Freshdesk app management page.

2 Likes

@rajezz - We doubt if this problem is very specific to your Freshdesk account. I will drop in a private message to figure out next steps to solve this problem.

1 Like

Also, can you try triggering ‘onAppInstall’ event in the previous way by navigating to http://localhost:1001/web/events as in the steps here ? Please let me know your findings.

1 Like

@Saif

All the product events and onAppInstall are getting triggered in the local testing. Only it is not triggered in the custom app.

1 Like

@rajezz I noticed a support ticket I’m looking into being linked to this thread as well. Could you share the Custom App id?

3 Likes

Hi @Gangeshwari_Rajavelu,

Hope you’re doing good!

Our custom app name is 4170 - secondary account testing and app ID is 38029.

Kindly share your findings.

Thank you.

2 Likes

@rajezz We suspect the problem roots from how the product events have been declared. Can you try one of the following to see the problem is solved?

Platform Version 2.0

manifest.json

{
  "platform-version": "2.0",
  "product": {
    "freshdesk": {
      "location": {
        "ticket_sidebar": {
          "url": "index.html",
          "icon": "styles/images/icon.svg"
        }
      }
    }
  }
}

Declaration of serverless product events in server.js

exports = {

  events: [
    { event: 'onTicketCreate' ,  callback: 'onTicketCreateHandler'  },
    { event: 'onAppInstall'   ,  callback: 'onAppInstallHandler'    },
    { event: 'onExternalEvent',  callback: 'onExternalEventHandler' },
    { event: 'onAppUninstall' ,  callback: 'onAppUninstallHandler'  }
  ],

  onAppInstallHandler: function(args) {

    generateTargetUrl()
    .then(function(url) {
      console.log(url);

      // Make request to third party products (ex. JIRA) to register the webhook for this Url
      renderData();
    }, function(err) {
      
      console.log(err);
      renderData({
        message: 'Error generating target Url'
      });
    });
  },

  onTicketCreateHandler: function(args) {
    console.log(args);
  },

  onExternalEventHandler: function(args) {
    // Events pushed from third pary products (ex. JIRA)
  },

  onAppUninstallHandler: function(args) {
    // De-Register webhook from third party
    renderData();
  }
};

if in case,

Platform Version 2.1

manifest.json

{
   "platform-version":"2.1",
   "product":{
      "freshdesk":{
         "location":{
            "ticket_sidebar":{
               "url":"index.html",
               "icon":"styles/images/icon.svg"
            }
         },
         "events":{
            "onTicketCreate":{
               "handler":"onTicketCreateHandler"
            },
            "onTicketUpdate":{
               "handler":"onTicketUpdateHandler"
            }
         }
      }
   }
}

Declaration of serverless product events in server.js


exports = {
  "onTicketCreate": function(){...},
 "onTicketUpdate": function(){...}
}

:bulb: It is not allowed to declare the serverless events in Platform version 2.1 -> manifest.json and define them in the way of Platform version 2.0 -> Declaration of serverless product events in server.js or the vice versa.

In other words,
if using Platform version 2.0 then
1. No events to be declared in manifest.json
2. Events and call backs to be declared as an array in the server.js

if using Platform version 2.1 then
1. Events to be declared as nested objects within the product in the manifest.json
2. Events functions must be declared in the exports section directly in the server.js

6 Likes

Hi @Saif

Thanks for the solution. It worked for us.

3 Likes