Let's Encrypt Fails with http_authorization line 6 error

Brand new installation of GitLab CE on stock Debian server. I have followed the directions here: SSL Configuration | GitLab and have read several other forum posts with similar descriptions. I have also tested the URL at https://letsdebug.net with no errors. Below are the changes I made to gitlab.rb and the output of the gitlab-ctl reconfigure command (truncated to comply with character limitations).

external_url 'https://my.domain.com'
letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['webmaster@my.domain.com'] # This should be an array of email addresses to add as contacts
letsencrypt['auto_renew'] = true
letsencrypt['auto_renew_hour'] = 17
letsencrypt['auto_renew_minute'] = 22 # Should be a number or cron expression, if specified.
letsencrypt['auto_renew_day_of_month'] = "*/20"
Starting Chef Infra Client, version 15.17.4
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - package (0.1.0)
  - logrotate (0.1.0)
  - postgresql (0.1.0)
  - redis (0.1.0)
  - registry (0.1.0)
  - gitaly (0.1.0)
  - praefect (0.1.0)
  - gitlab-pages (0.1.0)
  - letsencrypt (0.1.0)
  - nginx (0.1.0)
  - runit (5.1.3)
  - acme (4.1.3)
  - crond (0.1.0)
  - monitoring (0.1.0)
  - gitlab-kas (0.1.0)
  - mattermost (0.1.0)
  - consul (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
...
...
...
Recipe: gitlab::nginx
  * directory[/var/opt/gitlab/nginx] action create (up to date)
  * directory[/var/opt/gitlab/nginx/conf] action create (up to date)
  * directory[/var/log/gitlab/nginx] action create (up to date)
  * link[/var/opt/gitlab/nginx/logs] action create (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-http.conf] action create (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-smartcard-http.conf] action delete (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-health.conf] action create (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-pages.conf] action delete (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-registry.conf] action create (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-mattermost-http.conf] action delete (up to date)
  * template[/var/opt/gitlab/nginx/conf/nginx-status.conf] action create (up to date)
  * consul_service[nginx] action delete
    * file[/var/opt/gitlab/consul/config.d/nginx-service.json] action delete (up to date)
     (up to date)
  * template[/var/opt/gitlab/nginx/conf/nginx.conf] action create (up to date)
Recipe: nginx::enable
  * service[nginx] action nothing (skipped due to action :nothing)
  * runit_service[nginx] action enable
    * ruby_block[restart_service] action nothing (skipped due to action :nothing)
    * ruby_block[restart_log_service] action nothing (skipped due to action :nothing)
    * ruby_block[reload_log_service] action nothing (skipped due to action :nothing)
    * directory[/opt/gitlab/sv/nginx] action create (up to date)
    * template[/opt/gitlab/sv/nginx/run] action create (up to date)
    * directory[/opt/gitlab/sv/nginx/log] action create (up to date)
    * directory[/opt/gitlab/sv/nginx/log/main] action create (up to date)
    * template[/opt/gitlab/sv/nginx/log/config] action create (up to date)
    * ruby_block[verify_chown_persisted_on_nginx] action nothing (skipped due to action :nothing)
    * link[/var/log/gitlab/nginx/config] action create (up to date)
    * template[/opt/gitlab/sv/nginx/log/run] action create (up to date)
    * directory[/opt/gitlab/sv/nginx/env] action create (up to date)
    * ruby_block[Delete unmanaged env files for nginx service] action run (skipped due to only_if)
    * template[/opt/gitlab/sv/nginx/check] action create (skipped due to only_if)
    * template[/opt/gitlab/sv/nginx/finish] action create (skipped due to only_if)
    * directory[/opt/gitlab/sv/nginx/control] action create (up to date)
    * link[/opt/gitlab/init/nginx] action create (up to date)
    * file[/opt/gitlab/sv/nginx/down] action nothing (skipped due to action :nothing)
    * directory[/opt/gitlab/service] action create (up to date)
    * link[/opt/gitlab/service/nginx] action create (up to date)
    * ruby_block[wait for nginx service socket] action run (skipped due to not_if)
     (up to date)
  * execute[reload nginx] action nothing (skipped due to action :nothing)
Recipe: gitlab::remote-syslog_disable
  * service[remote-syslog] action nothing (skipped due to action :nothing)
  * runit_service[remote-syslog] action disable
    * ruby_block[disable remote-syslog] action run (skipped due to only_if)
     (up to date)
Recipe: gitlab::storage-check_disable
  * service[storage-check] action nothing (skipped due to action :nothing)
  * runit_service[storage-check] action disable
    * ruby_block[disable storage-check] action run (skipped due to only_if)
     (up to date)
Recipe: gitlab-pages::disable
  * service[gitlab-pages] action nothing (skipped due to action :nothing)
  * runit_service[gitlab-pages] action disable
    * ruby_block[disable gitlab-pages] action run (skipped due to only_if)
     (up to date)
Recipe: registry::enable
  * directory[create /var/opt/gitlab/registry] action create (up to date)
  * account[Docker registry user and group] action create
    * group[Docker registry user and group] action create (up to date)
    * linux_user[Docker registry user and group] action create (up to date)
     (up to date)
  * directory[create /var/opt/gitlab/registry and set the owner] action create (up to date)
  * directory[create /var/log/gitlab/registry and set the owner] action create (up to date)
  * env_dir[/opt/gitlab/etc/registry/env] action create
    * directory[/opt/gitlab/etc/registry/env] action create (up to date)
    * file[/opt/gitlab/etc/registry/env/SSL_CERT_DIR] action create (up to date)
     (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/shared/registry] action create (up to date)
  * file[/var/opt/gitlab/registry/gitlab-registry.crt] action create (up to date)
  * template[/var/opt/gitlab/registry/config.yml] action create (up to date)
  * service[registry] action nothing (skipped due to action :nothing)
  * runit_service[registry] action enable
    * ruby_block[restart_service] action nothing (skipped due to action :nothing)
    * ruby_block[restart_log_service] action nothing (skipped due to action :nothing)
    * ruby_block[reload_log_service] action nothing (skipped due to action :nothing)
    * directory[/opt/gitlab/sv/registry] action create (up to date)
    * template[/opt/gitlab/sv/registry/run] action create (up to date)
    * directory[/opt/gitlab/sv/registry/log] action create (up to date)
    * directory[/opt/gitlab/sv/registry/log/main] action create (up to date)
    * template[/opt/gitlab/sv/registry/log/config] action create (up to date)
    * ruby_block[verify_chown_persisted_on_registry] action nothing (skipped due to action :nothing)
    * link[/var/log/gitlab/registry/config] action create (up to date)
    * template[/opt/gitlab/sv/registry/log/run] action create (up to date)
    * directory[/opt/gitlab/sv/registry/env] action create (up to date)
    * ruby_block[Delete unmanaged env files for registry service] action run (skipped due to only_if)
    * template[/opt/gitlab/sv/registry/check] action create (skipped due to only_if)
    * template[/opt/gitlab/sv/registry/finish] action create (skipped due to only_if)
    * directory[/opt/gitlab/sv/registry/control] action create (up to date)
    * link[/opt/gitlab/init/registry] action create (up to date)
    * file[/opt/gitlab/sv/registry/down] action nothing (skipped due to action :nothing)
    * directory[/opt/gitlab/service] action create (up to date)
    * link[/opt/gitlab/service/registry] action create (up to date)
    * ruby_block[wait for registry service socket] action run (skipped due to not_if)
     (up to date)
  * version_file[Create version file for Registry] action create
    * file[/var/opt/gitlab/registry/VERSION] action create (up to date)
     (up to date)
Recipe: mattermost::disable
  * service[mattermost] action nothing (skipped due to action :nothing)
  * runit_service[mattermost] action disable
    * ruby_block[disable mattermost] action run (skipped due to only_if)
     (up to date)
Recipe: letsencrypt::enable
  * ruby_block[http external-url] action run (skipped due to only_if)
  * directory[/etc/gitlab/ssl] action create (up to date)
  * directory[/var/log/gitlab/lets-encrypt] action create (up to date)
  * acme_selfsigned[my.domain.com] action create
    * file[my.domain.com SSL selfsigned key] action create_if_missing (up to date)
    * file[my.domain.com SSL selfsigned crt] action create_if_missing (up to date)
    * file[my.domain.com SSL selfsigned chain] action create_if_missing (skipped due to not_if)
     (up to date)
Recipe: letsencrypt::http_authorization
  * letsencrypt_certificate[my.domain.com] action create
    * acme_certificate[staging] action create
      * file[my.domain.com SSL key] action create_if_missing (up to date)
      
      ================================================================================
      Error executing action `create` on resource 'acme_certificate[staging]'
      ================================================================================
      
      Acme::Client::Error::Timeout
      ----------------------------
      Acme::Client::Error::Timeout
      
      Cookbook Trace:
      ---------------
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/libraries/acme.rb:39:in `acme_client'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/libraries/acme.rb:47:in `acme_order_certs_for'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/resources/certificate.rb:87:in `block in class_from_file'
      
      Resource Declaration:
      ---------------------
      suppressed sensitive resource output
      
      Compiled Resource:
      ------------------
      suppressed sensitive resource output
      
      System Info:
      ------------
      chef_version=15.17.4
      platform=debian
      platform_version=11
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
      program_name=/opt/gitlab/embedded/bin/chef-client
      executable=/opt/gitlab/embedded/bin/chef-client
      
    
    ================================================================================
    Error executing action `create` on resource 'letsencrypt_certificate[my.domain.com]'
    ================================================================================
    
    Acme::Client::Error::Timeout
    ----------------------------
    acme_certificate[staging] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/letsencrypt/resources/certificate.rb line 41) had an error: Acme::Client::Error::Timeout: Acme::Client::Error::Timeout
    
    Cookbook Trace:
    ---------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/libraries/acme.rb:39:in `acme_client'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/libraries/acme.rb:47:in `acme_order_certs_for'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/resources/certificate.rb:87:in `block in class_from_file'
    
    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/letsencrypt/recipes/http_authorization.rb
    
      6: letsencrypt_certificate site do
      7:   crt node['gitlab']['nginx']['ssl_certificate']
      8:   key node['gitlab']['nginx']['ssl_certificate_key']
      9:   notifies :run, "execute[reload nginx]", :immediate
     10:   notifies :run, 'ruby_block[display_le_message]'
     11:   only_if { omnibus_helper.service_up?('nginx') }
     12: end
    
    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/letsencrypt/recipes/http_authorization.rb:6:in `from_file'
    
    letsencrypt_certificate("my.domain.com") do
      action [:create]
      default_guard_interpreter :default
      declared_type :letsencrypt_certificate
      cookbook_name "letsencrypt"
      recipe_name "http_authorization"
      crt "/etc/gitlab/ssl/my.domain.com.crt"
      key "/etc/gitlab/ssl/my.domain.com.key"
      alt_names []
      cn "my.domain.com"
      only_if { #code block }
    end
    
    System Info:
    ------------
    chef_version=15.17.4
    platform=debian
    platform_version=11
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client
    

Running handlers:
There was an error running gitlab-ctl reconfigure:

letsencrypt_certificate[my.domain.com] (letsencrypt::http_authorization line 6) had an error: Acme::Client::Error::Timeout: acme_certificate[staging] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/letsencrypt/resources/certificate.rb line 41) had an error: Acme::Client::Error::Timeout: Acme::Client::Error::Timeout

Running handlers complete
Chef Infra Client failed. 0 resources updated in 01 minutes 18 seconds

I had the same problem but I can’t fix it please any one face this error and fix it?

Hi did you find the solution?