Skip to content

Exception calling "GetResult" with "0" argument(s): "An error occurred while sending the request." #123

@haviay

Description

@haviay

Hi,
I got this error:

Exception calling "GetResult" with "0" argument(s): "An error occurred while sending the request."
At C:\...\WindowsPowerShell\Modules\ACME-PS\1.2.3\ACME-PS.psm1:3256 char:13
             throw [AcmeHttpException]::new($response.ErrorMessage, $r ...

     CategoryInfo          : OperationStopped: (:) [], AcmeHttpException
     FullyQualifiedErrorId : Exception calling "GetResult" with "0" argument(s): "An error occurred while sending the
    request."

At C:\...\Documents\WindowsPowerShell\Modules\ACME-PS\1.2.3\ACME-PS.psm1:3256 char:13
            throw [AcmeHttpException]::new($response.ErrorMessage, $r ...

     CategoryInfo          : OperationStopped: (:) [], AcmeHttpException
     FullyQualifiedErrorId : Exception calling "GetResult" with "0" argument(s): "An error occurred while sending the
    request."

while I run this code(it worked for me many times before):


$documentRoot = "C:\...\prod_Routing.Valoreti";
$acmeServiceName = "LetsEncrypt";

$contactMailAddresses = @("admin@woily.com");

$acmeStateDir = "C:\CertsV2\c01\pfx\$certname.pfx";
$certFile = "C:\CertsV2\c01\pfx\woily1-$(get-date -format yyyy-MM-dd--HH-mm).pfx";



Import-Module 'ACME-PS';

$dnsIdentifiers = @("aaa.com", "bbb.com"	)


$order = New-ACMEOrder -State $acmeStateDir -Identifiers $dnsIdentifiers;

if ($null -eq $order) { # Will fetch the order
    $order = Find-ACMEOrder -State $acmeStateDir -Identifiers $dnsIdentifiers;
}
$authorizations = @(Get-ACMEAuthorization -State $acmeStateDir -Order $order);

foreach($authz in $authorizations) {
    $challenge = Get-ACMEChallenge -State $acmeStateDir -Authorization $authZ -Type "http-01";
    $chFilename = $documentRoot + $challenge.Data.RelativeUrl;
    $chDirectory = [System.IO.Path]::GetDirectoryName($chFilename);
 
    if(-not (Test-Path $chDirectory)) {
        New-Item -Path $chDirectory -ItemType Directory;
    }

    Set-Content -Path $chFilename -Value $challenge.Data.Content -NoNewline;  
   
    $challenge | Complete-ACMEChallenge -State $acmeStateDir;
}

while($order.Status -notin ("ready","invalid")) {
    Start-Sleep -Seconds 10;
    $order | Update-ACMEOrder -State $acmeStateDir -PassThru;
}

if($order.Status -ieq ("invalid")) {
    $order | Get-ACMEAuthorizationError -State $acmeStateDir;
    throw "Order was invalid";
}

Complete-ACMEOrder -State $acmeStateDir -Order $order -GenerateCertificateKey;
while(-not $order.CertificateUrl) {
    Start-Sleep -Seconds 15
    $order | Update-ACMEOrder -State $acmeStateDir -PassThru
}

Export-ACMECertificate -State $acmeStateDir -Order $order -Path $certFile;

Import-PFXCertificate -FilePath $certFile -CertStoreLocation Cert:\LocalMachine\My


Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions