anchordotdev / cli

MIT License
386 stars 6 forks source link

Error: acme/autocert: certificate is not valid yet #21

Closed joshuabusinge closed 4 months ago

joshuabusinge commented 5 months ago

Are there any additional details you would like to share?


Command: anchor lcl setup Executable: D:\ReactProjects\stripe-payment\anchor.exe Version: 0.0.38 (windows/amd64) Commit: 38a58bce9066abd76402b4acf560bfce5c03ec94 BuildDate: 2024-06-25T19:20:43Z Arguments: [] Flags: [] Timestamp: 2024-06-27T19:32:55.4281756Z Stdout:

# Setup lcl.host Application `anchor lcl setup`
    | We'll gather details from you and your system to customize setup instructions.
    - Scanned current directory.
    - Entered javascript application server type.
    - Entered stripe-payment application name.
    - Entered stripe-payment.lcl.host domain for local application development.
    - Resolved stripe-payment.lcl.host domain: success!
    | Now we'll provision Anchor.dev resources and HTTPS certificates for you.
    - Creating stripe-payment [stripe-payment.lcl.host, stripe-payment.localhost] javascript resources on Anchor.dev… ⠋
geemus commented 5 months ago

@joshuabusinge - Hey, sorry to hear you are having problems.

After some investigation it looks like the most likely cause is clock drift. In particular, it seems likely that either your computer or the server was far enough out of sync that the certificate that ended up being created would fail in this way.

Could you ensure your systems clock is updated to be accurate and try again?

joshuabusinge commented 5 months ago

To what time zone should the system's clock be updated to be accurate?

geemus commented 5 months ago

@joshuabusinge Good question. The timezone shouldn't matter though, it's more about what time it actually says. Most systems allow for the clock to be set/updated by checking a remote server, but things can get out of sync if this is disabled or hasn't happened recently. If you check your settings for Date & Time and select that it can automatically update that should hopefully resync everything and then you can try this command again.

joshuabusinge commented 4 months ago

@geemus This finally worked after syncing my time within the Date and Time Settings. My new challenge is that the guide doesn't display. So i cannot generate the env credentials to plug into the .env.local.

Now follow your customized Anchor.dev setup guide to automat | management so you'll never have to manually provision certif - Opened https://anchor.dev/joshuabusinge/services/stripe-paym# Next Steps

How can i access the .env files to plug into the .env.local file

geemus commented 4 months ago

@joshuabusinge Thanks for trying that, I'm glad to hear that changing the clock got you further at least. We're working on making it a bit more flexible so this doesn't happen in the future.

Sorry to hear the setup guide also wasn't working as expected. How it's supposed to work is that the setup guide would open in your browser. If the browser didn't open for you, you should be able to copy the url and paste it into a browser to see it. If you have a browser open, you might just check to, perhaps it opened it and it just wasn't obvious. The url should look like: "https://anchor.dev/${username}/services/${service-slug}". I'll be curious to hear what you find so we can try to further refine this as well.

Just let me know if that doesn't work for some reason and we can try something else.

joshuabusinge commented 4 months ago

So what happens is that it opens in the browser shows the service dashboard. But am not seeing the setup guide. Here is a screenshot of what am seeing.

anchor

geemus commented 4 months ago

@joshuabusinge Ah, ok. Thanks for clarifying that really helps me understand what you meant better.

So in the process of running the command two services should be created. The first one during the lcl config step is setup as a diagnostic service. We intend for this service to just be used to test your local setup and let you know if anything is not working as expected. As such, we don't expect that you would need or want to do further setup with this service (that's why it doesn't show a setup guide).

Later in the process, during the lcl setup portion it should create the service that you would then setup and use. You should be able to run this directly to setup a service that should display the setup guide. And if you want to use stripe-payment as the name you should be able to do that if you first delete the existing diagnostic app of that name (you can do this by clicking on the pencil/square icon in the top right of the image you shared).

I hope that clarifies, just let me know if you have further questions or feedback.

geemus commented 4 months ago

We have now also updated our code so that it backdates certificates a little bit in order to help avoid problems around small amounts of clock skew. We think this should mean that this is unlikely to occur, so we'll close this, but do let us know if you have further questions or feedback.

joshuabusinge commented 4 months ago

Thanks @geemus