client.request.invokeTemplate, Error in establishing connection

Hello there,

I’m having the same issue as in this post:

https://community.freshworks.dev/t/request-method-not-working-in-custom-app-but-working-in-development-environment/11643

in my custom app I use the request API, in dev mode everything is ok,
but when I publish the app and test the same pattern I get a 502 “Error in establishing connection”.

I’m using latest fdk 9.1.1

requests.json is

"runAiAssistant": {
        "schema": {
          "protocol": "https",
          "method": "POST",
          "host": "<redacted>",
          "path": "/assistants/runassistant",
          "headers": {
            "Content-Type": "application/json"
          }
        
        },
        "options": {
          "retryDelay": 1000
        }
      }

invoking the template:

let body = {
            assistant_id: "<redacted>",
            messages: openAiMessages
          };

body = JSON.stringify(body);

let response = await client.request.invokeTemplate("runAiAssistant", {
   body
});

Hey @Carlo_Cecco,
Welcome to the Freshworks Developer Community! :tada:

Thanks for bringing this to our attention.

I see that you have redacted the host, I’m assuming that is a hardcoded value rather than an iparam value? Also, can you share your manifest.json with the platform version?

Hi,

yes host is hardcoded.
here’s manifest.json:

{
  "platform-version": "2.3",
  "product": {
    "freshdesk": {
      "location": {
        "ticket_conversation_editor": {
          "url": "views/ticket_details_page/ticket_conversation_editor.html",
          "icon": "styles/images/FD_app_icon.svg"
        }
      },
      "requests": {
        "getTicketWithConversations": {},
        "addPrivateNoteToTicket": {},
        "createOpenAiThread": {},
        "createOpenAiThreadAndRun": {},
        "createOpenAiRun": {},
        "getOpenAiRunStatus": {},
        "getOpenAiThreadMessages": {},
        "getOpenAiThreadMessage": {},
        "runAiAssistant": {},
        "getProductUrlInfo": {},
        "submitToolOutputsToRun": {}
      }
    }
  },
  "engines": {
    "node": "18.18.1",
    "fdk": "9.1.1"
  }
}

Thanks for sharing the manifest.json.

Is the request method throwing 502 error for runAiAssistant template alone? Or all of them?

I’m suspecting something with the host. Let me DM you to get some details.

Hi there,
I’ve been having a very similar issue and was wondering if this was resolved, and if so what the solution was?