Multiple request attempts even if maxAttempts set to 1

The client.post method retries the request multiple times, if the server answers with an error code like 5xx, even if i set the options to maxAttempts=1.
On my local environment everything works as expected but in production (the published custom app) it doesn’t work.

const headers = { Authorization: '<%= iparam.apiKey %>' };
const body = JSON.stringify(request);
const options = { headers: headers, body: body, maxAttempts: 1 };
client.request.post(url, options)

What goes wrong there?

@Chrizz

Strange.

Can you share the fdk.log file that is generated? Please mask any potential API Keys.

Hey @Chrizz

Let’s first welcome you to the Freshworks community :tada:
Thank you for reaching out with this strange conundrum.

Do you mind letting us know what version of the FDK you might be using? The following command would help.

fdk version

Do you also mind sharing with us a HAR file from the session where you reproduce this with the custom app?

2 Likes

Hey, thanks for your replies!
I use fdk version 8.3.1.
Here you can find the fdk.log:
fdk.log (19.9 KB)

It’s hard to reproduce this issue, because it’s only happening in the production custom app and only if the server needs too much time to answer. I’ll try my best to reproduce this again and share the HAR file with you.

Hmm… if this is happening only in production and not in local. Then fdk.log file is not helpful. (However, I checked the log file, but doesn’t have records of requests being sent proxy.js calls in it.)

Although it’s hard to reproduce the issue deliberately, do you frequently see this happening? If yes, I will try use a sample code to make requests and a dummy api that responds with 5XX.

Hey,
finally i could reproduce this issue. I created a new button in our production app which sends a request to our backend and created a test route in our backend which sends the status code 504.

The client always do 2 attempts, even if i set the maxAttempts to 1 (see HAR file).

request.har (15.5 KB)

Thanks for sending over the HAR file. We are trying to get our engineers to look at this in detail and confirm if this is indeed a bug.

Thank you! Approximately how long will it take before we have a result?
It’s really urgent because we use our custom FreshdeskApp to create refunds and replacement orders and because of this issue, sometimes (if the server takes too long) the freshdesk client starts a second attempt and so two refunds/replacement orders are created which is really bad :confused:

I appreciate your patience with this issue. I understand this is blocking your use case. I do not have an estimated timeline yet. We are trying to investigate if this is a bug in production.

I have learnt so far that there were some internal changes because of which the maxAttempts have been increased to a minimum of 2. This is not yet documented, so we are trying to figure out how to get it back to 1.

1 Like