← All fixes
Stripe: No such price; a similar object exists in test mode, but a live mode key was used
#131Error
No such price: 'price_123'; a similar object exists in test mode, but a live mode key was used to make this request.
Why it happens, and why this works
Test mode and live mode are separate in Stripe: prices, products, customers and webhooks made in one don't exist in the other. The price id came from test mode but the server uses a live key (or the other way round).
Fix
Use matching pairs: test keys (sk_test_) with test price ids, live keys (sk_live_) with live price ids. Recreate the product and price in live mode (or copy it to live mode from the dashboard) and keep the ids in environment variables per environment, not hard-coded.
Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
401 Unauthorized / invalid API key even though the key is set
#144401 Unauthorized: invalid x-api-key / Incorrect API key provided / authentication_error, while the key looks correct in .env
node --test <folder>/ fails with Cannot find module on Node 22+
#17Error: Cannot find module '/path/to/project/tests' (MODULE_NOT_FOUND) when running node --test tests/
nodeVerifiedNo reports yet
openai.AuthenticationError: Error code: 401 - Incorrect API key provided
#164openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-proj-****. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'code': 'invalid_api_key'}}