Giter Site home page Giter Site logo

Comments (4)

glatzert avatar glatzert commented on July 22, 2024

Could you take a look into the error details and provide them?
Essentially the IsError should only be true for HttpStatus Codes (returned from Let's Encrypt) > 400. Which normally means something went wrong, and we've no way to recover or do something useful afterwards.
That's why it issues an terminating error.

If you want to just try again, you can catch it with try {} catch {}.

Changing the throw to write-error, would not terminate the currently running function and would end up in more errors being thrown.

from acme-ps.

BRT917 avatar BRT917 commented on July 22, 2024

Error:
Server returned problem (Status: 400).
@{type=urn:ietf:params:acme:error:badNonce; detail=JWS has an invalid anti-replay nonce:
"0102awhAU9D2anavAc277bLVzM5Sfl-OIS0k22BFWkl_Atfk"; status=400}
At C:\Program Files\WindowsPowerShell\Modules\acme-ps\1.1.2\ACME-PS.psm1:1183 char:13
throw "$($response.ErrorMessage)"n$($response.Content)";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Server returned...k"; status=400}:String) [], RuntimeException
+ FullyQualifiedErrorId : Server returned problem (Status: 400).
@{type=urn:ietf:params:acme:error:badNonce; detail=JWS has an invalid anti-replay nonce: "0102awhAU9D2anavAc277bLVz
M5Sfl-OIS0kk22BFWkl_Atfk"; status=400}

If I try it again a few times with the same state and nonce it eventually goes through fine.

my thoughts on using a throw instead of write-error is that a throw doesn't seem to respect erroractionpreferences set by a script calling the module where a write-error would. i.e. It'd be better to give the user the decision on how to handle errors rather than deciding for them.

Edit: a try/catch should be able to get around it as is, but it seems real unnecessary to do it for every single acme-ps related command in a large script, I guess i'm just being a bit lazy here

from acme-ps.

glatzert avatar glatzert commented on July 22, 2024

Ah sorry, I was talking nonsense before.
The Response will report an error for everything HttpStatus >= 400.
Furthermore it'll extract a given nonce, if any and set that to the acme-state, so it's kind of self-healing.
Essentially (if you do not some kind of multi-session or multi-threading) the nonce should be okay with the next call.

The throw is used, because the functions normally won't end with calling Let's Encrypt, but will also use the result - that might be "lazy" on my side, because I did not want to use -errorAction 'Stop' everywhere. Also, your script probably cannot go on if such an error occures as well.

To relieve the problem, it'd be possible to use the problem-type (urn:ietf:params:acme:error:badNonce) to detect a faulty nonce and automatically retry with a new one. The detection could be done in AcmeHttpResponse and Invoke-SignedWebRequest could manage (a single) retry.

from acme-ps.

glatzert avatar glatzert commented on July 22, 2024

I included an automatic retry on nonce error.
Also you can now get the error details from the thrown exception.
Will be available in 1.1.3 once it's in the gallery. If you like to get a head start, try the beta ;).

from acme-ps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.