ACMESharp
ACMESharp copied to clipboard
Complete-ACMEChallenge -CleanUp gives Object reference not set to an instance of an object
I'm not sure if this is something I'm doing wrong or a bug, but after a successful Route53 challenge, I attempted to run Complete-ACMEChallenge with -CleanUp
and I get the following:
PS C:\Users\mzuba> Complete-ACMEChallenge alias1 -ChallengeType dns-01 -Handler aws-route53 -HandlerParameters @{HostedZoneId="xxxxxx";AwsProfileName="my-profile"} -CleanUp
Complete-ACMEChallenge : Object reference not set to an instance of an object.
At line:1 char:1
+ Complete-ACMEChallenge alias1 -ChallengeType dns-01 -Handler aws-ro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Complete-ACMEChallenge], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,ACMESharp.POSH.CompleteChallenge
Is this my error somewhere, or is there a bug that I'm not able to track down?
Looks like a bug. Can you try running the clean up again, and immediately after you get the error, can you run this block of PS code:
& {
$ex = $Error[0].Exception
while ($ex) {
"EX: $($ex.Message)"
" $($ex.StackTrace)"
$ex = $ex.InnerException
}
}
You may get a lot of verbose output, but it may show exactly where the bug is. You can paste it in verbatim or drag the output as a file and attach it to the ticket. Thanks.
Thanks for the help! Pretty simple output fortunately:
PS C:\Users\mzuba> & {
$ex = $Error[0].Exception
while ($ex) {
"EX: $($ex.Message)"
" $($ex.StackTrace)"
$ex = $ex.InnerException
}
}
EX: Object reference not set to an instance of an object.
at ACMESharp.AcmeClient.HandleChallenge(AuthorizationState authzState, String challengeType, String handlerName, IReadOnlyDictionary`2 handlerParams, Boolean cleanUp) in C:\projects\acmesharp\ACMESharp\ACMESharp\AcmeClient.cs:line 457
at ACMESharp.POSH.CompleteChallenge.ProcessRecord() in C:\projects\acmesharp\ACMESharp\ACMESharp.POSH\CompleteChallenge.cs:line 299
at System.Management.Automation.CommandProcessor.ProcessRecord()
What version of ACMESharp are you using?
PS> Get-Module ACMESharp | select Version
I thought I was using the latest, as I installed a few days ago, but noticed that there is a new version as of yesterday on Powershell Gallery.
I currently have 0.8.5.313. Let me try upgrading and trying again.
Actually, I found the bug -- it's at this line in the code that you have.
And I was able to verify it with my (latest) version as well.
Can you try to run the same clean up operation again but this time, add the -Regenerate
parameter flag to your command?
That seems to do the trick. Is that a temporary fix until a new version is released with a permanent fix? I only ask because I'm writing a Powershell script to manage SSL certs on 100+ servers from a central server so I don't want to forget to go in and remove that if it won't be needed in a future version.
It is temporary, yes, there's some state that's being deleted and overwritten accidentally, and the flag I gave you forces ACMESharp to recompute that state with the CleanUp invocation.