#toml-subscription-testclock
1 messages ยท Page 1 of 1 (latest)
@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?
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.
Can you still reproduce? Just to be clear
yes, consistently
๐ @valid grail do you have the CLI running via stripe listen currently?
I do now
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?
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.
It can be affected by that, yes.
Since Invoice finalization can rely on webhook response
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
Gotcha yep then that sounds like it could be it
I'm for sure not running stripe listen now, and my "Local listener" shows status = "disconnected" in my stripe account (https://dashboard.stripe.com/test/webhooks). Test still fails.
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.
Hmm can you share the Subscription ID of your most recent test?
sub_1OJiU7FZNAtUJ7m1lb8WmvXl
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?
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.
Hmm is something booting the CLI in your code when the test runs?
no, certainly nothing I wrote. Not sure what gets installed when the CLI is installed.
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...
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".
Hi there ๐ jumping in as my teammate needed to step away. Thank you for that clarification!
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:
- https://dashboard.stripe.com/test/subscriptions/sub_1OJjLqFZNAtUJ7m10UDscYgF In Events, I see "Customer [id]'s trial on [plan name] will end in 13 days. But in test-clock land, the subscription is created with a trial set to end 2 days after creation.
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.
Yup, that sounds like what my teammates are digging into.
great, thanks!
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.
Should I be diligent about describing the issue completely, or can I simply reference this thread for the details?
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)
sure thing, will do. Thanks all. For my info, does it look like something is afoot separate from the CLI issue we previously thought?