Skip to content

Commit 10c4c71

Browse files
fix: if certificate obtain got failed log it and mark as failed (#1114) (#1115)
* fix: if certificate obtain got failed log it and mark as failed * fix: log more info about ssl cert issue failure (cherry picked from commit 527b940) Co-authored-by: Tanmoy Sarkar <57363826+tanmoysrt@users.noreply.github.com>
1 parent 4f096ba commit 10c4c71

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ssl_manager/generator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ func (s Manager) ObtainCertificate(domain string, privateKeyStr string) (string,
2626
// Parse the DER-encoded key data
2727
privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
2828
if err != nil {
29-
return "", errors.New("unable to parse private key for domain")
29+
return "", errors.New("unable to parse private key for domain > " + err.Error())
3030
}
3131
certs, err := s.client.ObtainCertificate(s.ctx, s.account, privateKey, []string{domain})
3232
if err != nil {
33-
return "", errors.New("unable to obtain certificate")
33+
return "", errors.New("unable to obtain certificate > " + err.Error())
3434
}
3535
// Get the certificate
3636
certificate := certs[0]

swiftwave_service/worker/process_ssl_request.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ func (m Manager) SSLGenerate(request SSLGenerateRequest, ctx context.Context, _
6161
fullChain, err := m.ServiceManager.SslManager.ObtainCertificate(domain.Name, domain.SSLPrivateKey)
6262
if err != nil {
6363
// don' requeue, if anything happen user can anytime re-request for certificate
64-
logger.CronJobLoggerError.Println("Failed to obtain certificate", err.Error(), "\nWill retry later")
64+
logger.CronJobLoggerError.Println("Failed to obtain certificate", err.Error())
65+
_ = domain.UpdateSSLStatus(ctx, dbWithoutTx, core.DomainSSLStatusFailed)
6566
return nil
6667
}
6768
// store certificate

0 commit comments

Comments
 (0)