Skip to content

Commit 9f4bd60

Browse files
committed
chore: add retry limit for domain_control_validation_failed
1 parent 97786f4 commit 9f4bd60

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/dashmate/src/listr/tasks/ssl/zerossl/obtainZeroSSLCertificateTaskFactory.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ export default function obtainZeroSSLCertificateTaskFactory(
173173
skip: (ctx) => ctx.certificate && !['pending_validation', 'draft'].includes(ctx.certificate.status),
174174
task: async (ctx, task) => {
175175
let retry;
176+
let autoRetryCount = 0;
177+
const MAX_AUTO_RETRIES = 3; // Adjust based on requirements
176178
do {
177179
try {
178180
await verifyDomain(ctx.certificate.id, ctx.apiKey);
@@ -189,6 +191,14 @@ export default function obtainZeroSSLCertificateTaskFactory(
189191

190192
if (e.type === 'domain_control_validation_failed') {
191193
// Retry on this undocumented error whatever it means
194+
if (autoRetryCount >= MAX_AUTO_RETRIES) {
195+
throw e;
196+
}
197+
autoRetryCount++;
198+
if (process.env.DEBUG) {
199+
// eslint-disable-next-line no-console
200+
console.warn(`Retry ${autoRetryCount}/${MAX_AUTO_RETRIES} verification due to domain_control_validation_failed error`);
201+
}
192202
await wait(5000);
193203
} else {
194204
if (ctx.noRetry !== true) {

0 commit comments

Comments
 (0)