stripe/stripe-cli

Have the CLI Reuse and Cleanup the test data it creates (i.e. clean up your own mess)

Opened this issue · 8 comments

Problem

Use the Stripe CLI to build out integrations without interfering with other users creating test products that are effectively "drafts" waiting to move to production or getting in their way.

As it stands the Stripe CLI can create hundreds or thousands of products, customers, etc. in a single day of development and testing. It's unacceptable that this test data is left in my test account with no simple way to remove it without also removing the test data I created manually (i.e. the drafts of what will be my live plans/products eventually)

Feature

  1. Stripe CLI should re-use the products, customers, etc. that it creates rather than creating new ones on every trigger command.
  2. Stripe CLI should keep track of the things (maybe using metadata on the items or something, or storing it locally if required) it creates and provide a mechanism to delete all of the CLI-created test data at the end of a session or on-demand.

As I see it the stripe CLI is creating a mess in my test account. It's the CLIs responsibility to clean up after itself.

Also see:

Thanks for the suggestion! In the meantime, you can delete all test data on the account with a single click via the Dashboard.

The problem I'm facing is that I have products in the test environment that I need to keep. Deleting the test data manually is at best tedious and at worst impossible.

chpmrc commented

Yeah this is quite the disappointment. Deleting all your test data also deletes all the products etc. that you carefully crafted, not just the mock products created by the CLI. Found out the hard way...

ginjo commented

Doing a google search for stripe test webhooks, I discovered the stripe-cli 'trigger' function and merrily went about developing and refining my webhook integration. I even created a handy wrapper script to display both sides of the operation in a split-pane screen session. Later, I went to my dashboard to change some settings and discovered the awful mess I'd made (Vat of Acid episode, Rick & Morty). Doing a full-wipe of my test-mode environment is not an option, as I have valuable prototype and longer-term test data that I need to keep.

If stripe-cli won't track and clean up the data it creates, we need some other options. Here are some suggestions.

  • Allow our stripe account to instantiate multiple test environments. Currently, test-mode is misleading. It's not really a mode, it's an environment. If we could create/delete test environments on-the-fly, we could avoid making a mess in our "main" development environment.
  • Give us a dashboard feature to allow batch/bulk/multiple deletions of data.
  • Include a sentence or two in the documentation, warning that the current implementation of the cli's stripe trigger will create a lot of data in the test environment with the only remedy being to delete ALL data.

I've stopped using trigger now.

Instead I create the event by using the checkout, then I replay the events that created as needed.

ginjo commented

@hades200082 Cool, are you using the CLI to replay, or is that a dashboard-only function?

I use the CLI to replay it.

@jsteele-stripe Any updates on this now we're all a year older?