acme.certificate.create function returns before record removes have finished #31

Open
by Ghost opened 4 years ago · 5 comments
Ghost commented 4 years ago

I'm running acme.js in a google function and wish to make sure that dns record removes have completed before the acme.js function completes.
Associated PR https://git.coolaj86.com/coolaj86/acme.js/pulls/30

I'm running acme.js in a google function and wish to make sure that dns record removes have completed before the acme.js function completes. Associated PR https://git.coolaj86.com/coolaj86/acme.js/pulls/30
Owner

Why?

What's the benefit or necessity of that?

Having the remove happen without consequence was intentional. If you use the notify callback you can catch the error and handle it that way, but I'm not aware of a use case where the rest of the process should be held up if the remove fails - it won't affect your ability to get a certificate, and it's not recoverable.

What was happening that this caused an issue for you? (i.e. Were you getting API rate limit errors?)

How do you handle or resolve it?

Why? What's the benefit or necessity of that? Having the remove happen without consequence was intentional. If you use the `notify` callback you can catch the error and handle it that way, but I'm not aware of a use case where the rest of the process should be held up if the remove fails - it won't affect your ability to get a certificate, and it's not recoverable. What was happening that this caused an issue for you? (i.e. Were you getting API rate limit errors?) How do you handle or resolve it?

I'll have to do a little more testing, but since I would be running the renewals in a Google Function, I wouldn't want the Google Function to return before the removes have been called and returned. I'm trying to avoid a bunch of orphaned DNS record entries.

I noticed when I was running locally that the main function would return, then the removes would complete which prompted me to do the initial investigation.

I'll have to do a little more testing, but since I would be running the renewals in a Google Function, I wouldn't want the Google Function to return before the removes have been called and returned. I'm trying to avoid a bunch of orphaned DNS record entries. I noticed when I was running locally that the main function would return, then the removes would complete which prompted me to do the initial investigation.

I did some very basic testing, but it seems the 'create' function is returning before the 'remove' functions have completed. I haven't dug too deeply in the code so I'm making a lot of assumptions, but since you said the design was intentional, then maybe I should be looking at just writing my own acme client and design it to run in a Google Function.

I did some very basic testing, but it seems the 'create' function is returning before the 'remove' functions have completed. I haven't dug too deeply in the code so I'm making a lot of assumptions, but since you said the design was intentional, then maybe I should be looking at just writing my own acme client and design it to run in a Google Function.
Owner

Does the Google Function forcefully exit before the event loop is clear?

Why does it think that you're code is "done" when it hasn't finished running yet?

Generally speaking node keeps running until you crash or process.exit().

Does the Google Function forcefully exit before the event loop is clear? Why does it think that you're code is "done" when it hasn't finished running yet? Generally speaking node keeps running until you crash or `process.exit()`.
Owner

I'd be happy to add the corresponding non-error challenge_remove event for success: https://git.coolaj86.com/coolaj86/acme.js/src/branch/master/acme.js#L784

Can you make your application not exit until it gets that event?

(or do something like this, if you don't want to listen to events?)

return new Promise(function () {
  setTimeout(resolve, 100)
})

I just don't a want slow and non-essential API requests to hold up the the entire pipeline.

I'd be happy to add the corresponding non-error `challenge_remove` event for success: https://git.coolaj86.com/coolaj86/acme.js/src/branch/master/acme.js#L784 Can you make your application not exit until it gets that event? (or do something like this, if you don't want to listen to events?) ``` return new Promise(function () { setTimeout(resolve, 100) }) ``` I just don't a want slow and non-essential API requests to hold up the the entire pipeline.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.