Skip to content

Commit 5a5c769

Browse files
committed
Fix error message from convert_to_der_and_cache method
1 parent 7125960 commit 5a5c769

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

lib/resty/auto-ssl/ssl_certificate.lua

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,16 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
135135
end
136136

137137
if cert and cert["fullchain_pem"] and cert["privkey_pem"] then
138-
local cert_der = convert_to_der_and_cache(domain, cert)
138+
local cert_der, cert_der_err = convert_to_der_and_cache(domain, cert)
139+
140+
if cert_der_err then
141+
ngx.log(ngx.ERR, "auto-ssl: error converting certificate for ", domain, ": ", cert_der_err)
142+
end
143+
144+
if not cert_der then
145+
return nil, "empty cert_der received"
146+
end
147+
139148
cert_der["newly_issued"] = false
140149
return cert_der
141150
end
@@ -144,7 +153,15 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
144153
if not ssl_options or ssl_options["generate_certs"] ~= false then
145154
cert = issue_cert(auto_ssl_instance, storage, domain)
146155
if cert and cert["fullchain_pem"] and cert["privkey_pem"] then
147-
local cert_der = convert_to_der_and_cache(domain, cert)
156+
local cert_der, cert_der_err = convert_to_der_and_cache(domain, cert)
157+
if cert_der_err then
158+
ngx.log(ngx.ERR, "auto-ssl: error converting certificate for ", domain, ": ", cert_der_err)
159+
end
160+
161+
if not cert_der then
162+
return nil, "empty cert_der received"
163+
end
164+
148165
cert_der["newly_issued"] = true
149166
return cert_der
150167
end

0 commit comments

Comments
 (0)