Azure-sdk-for-js: AppConfigurationClient does not retry when a request is throttled

Created on 4 Dec 2019  路  3Comments  路  Source: Azure/azure-sdk-for-js

  • Package Name: @azure/app-configuration
  • Package Version: 1.0.0-preview.9
  • Operating system: Win10 Enterprise 1909
  • [x] nodejs

    • version: 12.13.0

  • [ ] browser

    • name/version:

  • [x] typescript

    • version: 3.7.2

  • Is the bug related to documentation in

Describe the bug
AppConfigurationClient does not retry when a request is throttled. AppConfigurationClient throws a RestError with the 429 response.

To Reproduce

  1. Add a valid connection string where indicated in the typescript below and run. The code will attempt to add 200 keys to the App Configuration instance in parallel, outputting any errors to the console.
import { AppConfigurationClient, SetConfigurationSettingParam } from '@azure/app-configuration';

async function main() {

    // Add valid connection string
    const connectionString = "<connectionstring>";
    const client = new AppConfigurationClient(connectionString);

    const promises = [];
    const count = 200;

    for (let i = 0; i < count; i++) {       
        promises.push(setSetting(client, {
            key: `Key${i}`
        }));
    }

    await Promise.all(promises);
}

async function setSetting(client: AppConfigurationClient, setting: SetConfigurationSettingParam) {
    try {
        await client.setConfigurationSetting(setting);
    } catch (error) {
        console.log(`${setting.key}: ${error.statusCode} ${error.stack}`);
    }
}

main();

Expected behavior
AppConfigurationClient performs a retry when throttled (after the retry-after-ms in the 429 response). No errors should be reported and all 200 keys are created.

Additional context
When throttled, the AppConfigurationClient throws a RestError that looks like:

Key176: 429 Error: {"type":"https://azconfig.io/errors/too-many-requests","title":"The amount of requests sent to the server have surpassed the assigned quota","policy":"TotalRequests","status":429}
    at new RestError (<path>\node_modules\@azure\core-http\dist\coreHttp.node.js:1716:28)
    at <path>\node_modules\@azure\core-http\dist\coreHttp.node.js:3416:37
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Also, I checked the .NET SDK, and it does the retry, resulting in the exepcted behavior.

App Configuration Client customer-reported

Most helpful comment

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

All 3 comments

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

Thank you for this very detailed bug report. I was able to merge in a fix and we'll look to publish this next week.

@et13 - a fix for this has been published.

https://www.npmjs.com/package/@azure/app-configuration/v/1.0.0-preview.10
(edited to fix link to the actual current version)

Was this page helpful?
0 / 5 - 0 ratings