stripe-cli icon indicating copy to clipboard operation
stripe-cli copied to clipboard

Error when triggering reporting.report_run.succeeded

Open tainguyenbui opened this issue 2 years ago • 2 comments

Issue

When triggering reporting.report_run.succeeded event through the Stripe CLI stripe trigger reporting.report_run.succeeded

a 400 Bad Request Response is returned due to invalid interval.

Expected Behavior

A successful event is triggered and forwarded to my local webhook endpoint.

Steps to reproduce

simply run stripe trigger reporting.report_run.succeeded

Traceback

{
  "error": {
    "message": "Data for the report type balance.summary.1 is only available starting at 2022-04-29 00:00:00 UTC; you requested `interval_start` = 2022-01-01 14:03:52 UTC.",
    "param": "parameters.interval_start",
    "type": "invalid_request_error"
}

Potential fix

Update the following file: https://github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/reporting.report_run.succeeded.json

Suggested value: Start -> 1651403681 Ends -> 1652613281

Environment

macOS Big Sur 11.6.4

tainguyenbui avatar Aug 30 '22 12:08 tainguyenbui

Sadly it is huge blocker bug although could be resolved simply 😞 would anyone be able to test & accept this suggestion from @tainguyenbui soon?

ismailatkurt avatar Sep 01 '22 13:09 ismailatkurt

not many examples about overriding parameters; however, there is a solution to this issue. Thanks @brennank-stripe for the suggestion.

https://stripe.com/docs/cli/trigger

From above documentation, we can see that it is possible to override parameters. As a result, something like:

stripe trigger reporting.report_run.succeeded --override reporting:parameters.interval_start=<start_ts> --override reporting:parameters.interval_end=<end-ts> would do the job.

I assume this will also be a good fix for many other triggers.

In the long term, I think I would do some implementation in the CLI to override fixtures that contain timestamps that could be time bound sensitive.

tainguyenbui avatar Sep 09 '22 10:09 tainguyenbui