Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

api: detect and report lingering idempotency keys #204

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

bmizerany
Copy link
Contributor

@bmizerany bmizerany commented Dec 19, 2022

Stripe Idemptency Keys linger after a Test Mode data purge, causing
false positive responses from Stripe. One such scenario is creating a
customer using a deterministic Idempotency Key with a Tier orgID (e.g.
"create:customer:org:example") to suppress a duplicate request from a
dueling client. If after that key is created, and our Test Mode is
purged, we'll get a cached response back from Stripe telling us the
customer was created and give us the old response without actually
creating the customer in the now clean Test Mode. Using that customer ID
to create a subscription resulted in a "resource_not_found" error from
Stripe because the customer did not exist.

Tier now detects an error resulting from a lingering idempotency key
when creating a schedule for a customer that was thought to be created
just before attempting to create the schedule. The output should now be
more helpful.

This commit also introduces the new error code scheme with an error code
prefixed with ("TERR"). It is pronounced, "terror". Moving forward, all
new errors will have a TERR-code. This makes specific errors easier to
report and search for.

Stripe Idemptency Keys linger after a Test Mode data purge, causing
false positive responses from Stripe. One such scenario is creating a
customer using a deterministic Idempotency Key with a Tier orgID (e.g.
"create:customer:org:example") to suppress a duplicate request from a
dueling client. If after that key is created, and our Test Mode is
purged, we'll get a cached response back from Stripe telling us the
customer was created and give us the old response without actually
creating the customer in the now clean Test Mode. Using that customer ID
to create a subscription resulted in a "resource_not_found" error from
Stripe because the customer did not exist.

Tier now detects an error resulting from a lingering idempotency key
when creating a schedule for a customer that was thought to be created
just before attempting to create the schedule. The output should now be
more helpful.

This commit also introduces the new error code scheme with an error code
prefixed with ("TERR"). It is pronounced, "terror". Moving forward, all
new errors will have a TERR-code. This makes specific errors easier to
report and search for.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant