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

Hey, do you have any news about that topic? We still have multiple attempts with the setting maxAttempts: 1

@Developer-Platform - Is the maxAttempts increased to the minimum of 2 . How far along are we to get this back to 1 ?

The latest progress is still a work in progress over defaulting back maxAttempts:1

Hey guys, still no news? :frowning:

Hey @Chrizz,

Appreciate for your patience while we were investigating and getting to the bottom of this issue.

I’m happy to share with you that this issue has been fixed. The maxAttempts default value is 1 but due to some internal changes it had been increased to 2 and now reverted back. Now your API requests should not retry multiple times if there is a 5xx error code.

Also, thanks again for bringing this into our notice. Happy to help if you are facing any other concerns.

Please do confirm if the fix worked for you.

Happy building! :smiley:

2 Likes

Hey @zach_jones_noel, thanks for the great news. Everything is working as expected again! Thank you :slight_smile:

1 Like

Awesome! Thanks for confirming @Chrizz :+1:

Happy building! :smiley:

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.