Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Period start/end on invoice_line_item is no longer correct #43

Open
daniellangnet opened this issue Oct 3, 2019 · 4 comments
Open

Period start/end on invoice_line_item is no longer correct #43

daniellangnet opened this issue Oct 3, 2019 · 4 comments

Comments

@daniellangnet
Copy link

daniellangnet commented Oct 3, 2019

Sometime about a month ago around the beginning of September 2019 (using Stitch) the fields period__start and period__end started showing incorrect dates.

This only seems to affect invoice line items for invoices that were created as prorations. For example, let's say in the middle of the month an upgrade with a proration happens. The period__start used to have the same date as when the change/proration happened and the period__end used to be the end date of the regular billing cycle this was in.

Now, both period__start and period__end will always have the same date.

This is incorrect because if you retrieve such an invoice line item using the Stripe API directly, I can verify that the subobject "period" has a different "end" date than what is currently synced to the database.

The other reason why I know that this must be some kind of change that got introduced only about a month ago, is because all the invoice line items that were previously synced were correct. However, when I triggered a full resync in Stitch (by resetting the historical date), now all the data, even previously correct invoice line items have the same incorrect date (where period__start always matches period__end for proration line items).

I looked through the code and tried to see if there were any obvious changes around that time. Doesn't seem like it. So perhaps something on the Stripe API side changed that now causes this issue? Just guessing.

@KAllan357
Copy link
Contributor

@daniellangnet thanks for the report. One option you could try is to use your credentials and query the Stripe API directly using one of the Invoices you've found with this error.

curl https://api.stripe.com/v1/invoices/in_19yTU92eZvKYlo2C7uDjvu6v \
    -u sk_test_4eC39HqLyjWDarjtT1zdp7dc:

If the Stripe API is returning the incorrect data as well, I'd say your guess that this is a Stripe issue is correct. If the data appears correct from Stripe, but is incorrect within Stitch, there is some more subtle problem or perhaps an issue with Stripe's Event endpoint which might also yield Invoice Line Items if you're syncing that endpoint.

@daniellangnet
Copy link
Author

@KAllan357 Thanks for your response. I actually just responded to an email for Stitch support with an output from the Stripe API. I had the exact same idea you suggested and ran a query against it. What I found is that the Stripe API returns the correct period end timestamp but it's not correct in the database.

I agree with your assessment that this must be some kind of subtle issue in the Singer tap. I'm not familiar with Singer or Python, but I found this recent commit which could perhaps be the cause: 4adb53e

It would also roughly match with the timeline of the issue first appearing.

@KAllan357
Copy link
Contributor

I would definitely suggest syncing only Invoices and Invoice Line Items and avoid syncing Events and seeing if that resolves the issue.

@daniellangnet
Copy link
Author

@KAllan357 Problem is that I am not currently syncing events, never have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants