Smart Plug api call triggers circuit breaker

Hi I’m trying to trigger an api call from a button click within our smart plug but I get this response shown below. I appreciate any guidance you can give.

Here’s a code snippet of the call.

 updateSSP: function(type,weeknum,surveyid,userId){
    method: "POST",
    url: "/app/extension_proxy",
    processData: false,
    // async: false,
    data: JSON.stringify({
      url: `${surveyid}&status=${type}&week=${weeknum}`,
      method : "GET",
      headers: {"Content-Type": "application/json"},
    success: function(data, response, header, xhr, headers) {
      console.log('SSP: Submit Success');
    error: function(data) {
      $('#ssp_status_error').html(`<p>Update service unavailable</p><p> ${data.responseText}</p>`)
      console.log('SSP: Error');

[Error] Failed to load resource: the server responded with a status of 424 () (extension_proxy, line 0)
[Log] SSP: Error (378597564270154, line 94)
[Log] SSP: (378597564270154, line 95)
responseJSON: {hlErrorMessage: “Looks like your request triggered circuit breaker.…st end-point is up and then retry after sometime.”}

Hi @Adam_McLean, I could somehow try to help. But I have little context about “smart plug” that you are referring to. Can you please help me understand it?

Here are the type of apps I know - Types of Apps

Can I assume this to be a custom app?

Hi @Saif thanks for the reply.

I’ve written a custom smart plug which on load hits our endpoint. The endpoint supplies some pre-formatted html. Once displayed a clickable button, once clicked, hits a different endpoint to update our DB.

The second call is the one that fails and is the one I supplied I the code snippet.

What else would you like to know?

Thanks, @Adam_McLean. That helps.

How does your first API call happen? Does it happen form the frontend? I assume this because preformatted html which contains button will be displayed to app user. Is my assumption true?

From the code it looks like server.js file code.

The second API call; Does it happen via Server method Invocation?

Hi @Saif thanks for the quick response.
Just to clarify the endpoints are not attached to freshchat. The smart plug is completely front end, it’s a JS widget for the support agents view and appears on the right hand side of the screen.

I updated the script through the settings-> smart plugs.

Hi @Adam_McLean, I was able to refer to it. Let me see if I can get some help from :freshchat: Freshchat product team to get you the help that you need. Please allow me some time.

Hi @Saif,

I realised what the issue was. A white spaced value i.e ‘fun times’ rather than ‘fun-times’ had been passed through.
Once correct everything is working as expected.

Thanks for your help.

Thank you for sharing the solution as well @Adam_McLean. It will always help developers within community trying to solve similar problem. We will also work towards to share accurate answer sooner. :smiley:

This topic was automatically closed after 4 days. New replies are no longer allowed.