#toml-subscription-testclock

1 messages ยท Page 1 of 1 (latest)

dapper cloudBOT
ancient python
#

@valid grail looking

#

toml-subscription-testclock

ancient python
#

@valid grail we can't seem to reproduce ourselves. Does this happen all the time to all your Subscriptions? Have you been able to reproduce reliably outside of your automated tests?

#

Also when you say "first invoice" you mean the trial one right?

valid grail
#

Also when you say "first invoice" you mean the trial one right?

No, there's a "Trial Period" invoice that's created correctly when the trial starts in test clock time. Then there's a first "real" invoice that should get created when the trial ends, right? That's the one I'm referring to. For example, in_1OJhHLFZNAtUJ7m1AWFAKIx7.

Incidentally, another unexpected behavior I'm observing is that the expected finalization time for this invoice keeps advancing. Right now it says "invoice will be finalized and charged 12/4/23, 1:38 PM" (which is next minute). When I refresh in a minute, it'll say "1:39". Something about this invoice is conflicting with the test clock, somehow.

ancient python
#

Can you still reproduce? Just to be clear

valid grail
#

yes, consistently

dapper cloudBOT
wooden smelt
#

๐Ÿ‘‹ @valid grail do you have the CLI running via stripe listen currently?

valid grail
#

I do now

wooden smelt
#

Hmm but you didn't before?

#

We are able to reproduce the behavior you are seeing with the CLI listener running, but it is working for us without it running.

#

Can you ensure it is not running and then test again?

valid grail
#

Ok, interesting, so I just installed the CLI today and now that you mention it, that did correspond with this behavior starting. HOWEVER, I first was alerted to this because my tests failed when run in a github action -- that couldn't be affected by me running the CLI locally, right? Can't imagine.

wooden smelt
#

It can be affected by that, yes.

#

Since Invoice finalization can rely on webhook response

valid grail
#

oh wait, the CLI listen is tied to my test env in stripe, not just to my local environment, so I do see the connection now

wooden smelt
#

Gotcha yep then that sounds like it could be it

valid grail
#

I feel like I'm just missing one obvious thing at this point, because the timing of everything says the explanation has to be tied to that webhook.

wooden smelt
#

Hmm can you share the Subscription ID of your most recent test?

valid grail
#

sub_1OJiU7FZNAtUJ7m1lb8WmvXl

wooden smelt
#

Huh, yeah I can see your CLI is disconnected but Invoice isn't finalized...

#

What happens if you advance time slightly more?

#

Like 30 mins?

#

It looks like you advanced it exactly an hour, correct?

valid grail
#

It's actually 1 hr and 1 second.

I ran stripe logout and the first test run passed! But subsequent tests failed again.

Also updated it to advance 2 hrs past and test still fails.

wooden smelt
#

Hmm is something booting the CLI in your code when the test runs?

valid grail
#

no, certainly nothing I wrote. Not sure what gets installed when the CLI is installed.

wooden smelt
#

I'm pretty much out of ideas... it seems that this is related to the CLI in one way or another but I don't know why you aren't seeing the Invoice finalize when the CLI is disconnected...

dapper cloudBOT
valid grail
#

I don't actually see any evidence that stripe attempts to finalize the invoice. On the Invoice page, the only Event I see is "A draft invoice was created".

bronze yarrow
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needed to step away. Thank you for that clarification!

valid grail
#

Hey Toby, let me know if you need any clarifications on the situation discussed so far. Jumping ahead: I'm seeing more unexpected things. If you want to follow with me, I'm looking at sub_1OJjLqFZNAtUJ7m10UDscYgF.

In my test case, I'm using a test clock. I create the subcription on 11/20, set a trial end of 11/22 6am, then advance the clock to 11/22 8am.

Unexpected #1:

#

I just re-ran the test, but returned after subscription creation but before advancing the test clock past the trial end. I then advanced the test clock from the stripe UI and everything worked as expected -- the invoice due when the trial ends successfully is finalized and charge is attempted. That's all expected.

Interesting! Now I ran it again under the original conditions. The after-trial invoice was not finalized, and the UI showed it was due to be finalized 12/4 (today, non-test-clock time). Then I advanced the test clock 1 minute from the UI and that invoice WAS successfully finalized and charge attempted. So for some reason my API-call in the test case to advance the test clock is successfully advancing test-clock-time, but it's not finalizing the invoice as it should. Advancing the test clock from the UI makes everything work as expected.

bronze yarrow
#

Yup, that sounds like what my teammates are digging into.

valid grail
#

great, thanks!

bronze yarrow
#

Thank you for your patience while we look into this, but it's requiring more investigation than I anticipated. I think at this point moving this conversation to a support case would be better, so we can provide you with updates on that investigation as they become available. Would you mind writing in here:
https://support.stripe.com/contact/email?topic=api_integration
While doing so, please check the "I am a developer ..." checkbox, and mention that you were working with us here.

Please let me know once you have done so, and I'll make sure that gets routed correctly.

valid grail
#

Should I be diligent about describing the issue completely, or can I simply reference this thread for the details?

ancient python
#

I'd recommend being diligent + linking to this thread. If you aren't you'll get sent back anyways (sorry this can be a real hassle)

valid grail
#

sure thing, will do. Thanks all. For my info, does it look like something is afoot separate from the CLI issue we previously thought?