`ip-restriction` add-on uses a test-mode Stripe price ID in production
Description
Adding the IP Restriction add-on on OpenStatus Cloud fails with a Stripe error:
No such price:
price_1TMq0GBXJcTfzsyJrIVx9KPL; a similar object exists in test mode, but a live mode key was used to make this request.
Expected behavior
The IP Restriction add-on is added to the subscription and the workspace limit is updated, as it does in test mode.
Cause
In packages/api/src/router/stripe/utils.ts the production price ID for the ip-restriction add-on is a test-mode price:
{
feature: "ip-restriction",
price: {
monthly: {
priceIds: {
test: "price_1TMpxlBXJcTfzsyJ1woQtafW",
production: "price_1TMq0GBXJcTfzsyJrIVx9KPL", // <- test-mode price
},
},
},
}getPriceIdForFeature() returns this value when NEXT_PUBLIC_VERCEL_ENV === "production", and stripe.subscriptionItems.create in packages/api/src/router/stripe/index.ts then calls Stripe with the live key, which rejects it. The error is surfaced verbatim in the dashboard toast.
Both IDs were introduced in c141c73 (#2079) and have not been changed since.
Fix
Replace production with the live-mode price ID for the IP Restriction product (creating the product/price in live mode first if it does not exist yet).
Possibly affected too
Two other add-ons have identical test and production IDs, so one of the two modes must be wrong for each:
monitors— still carries aTODO: create the "Monitor Pack" product ... then paste the idssso
Steps to reproduce
- On OpenStatus Cloud (live), open Settings → Billing
- Enable the IP Restriction add-on
- The error toast above appears and the add-on is not added
Source: openstatusHQ/openstatus