Describe the bug
AppConfigurationClient does not retry when a request is throttled. AppConfigurationClient throws a RestError with the 429 response.
To Reproduce
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.
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)
Most helpful comment
Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.