Open boilerplatemax opened 1 year ago
Any logs in your vercel dashboard? Specifically you want to look at the logs for the create-ceckout-session
method.
Hey! I am facing the same issue in test mode, did you find a solution? Trying to switch into live mode did not even load the data for me. I noticed that at least for test mode it works fine when run locally
Works perfectly in test mode, however, switching the keys prevents the stripe payment page from opening. Anyone else have this issue?
Blank pop up alert:
Console is throwing this error:
Failed to load resource: the server responded with a status of 500 ()
Hey @boilerplatemax I just logged in to your website and tried to subscribe. It seems to be working now. How did you solve it? I am experiencing the same issue. Is it related to replacing your actual URL into a specific file? (I mean replacing localhost:3000 to your actual project domain).
Any logs in your vercel dashboard? Specifically you want to look at the logs for the
create-ceckout-session
method.
Yes @thorwebdev , I get this in the console:
Error in postData {url: '/api/create-checkout-session', data: {…}, res: Response} 500
@andriusmv that means there is an internal server error with your function. You'll need to check your vercel function logs: https://vercel.com/docs/concepts/deployments/logs#function-logs
@andriusmv that means there is an internal server error with your function. You'll need to check your vercel function logs: https://vercel.com/docs/concepts/deployments/logs#function-logs
@thorwebdev yes sir. I went there and got this:
[POST] /api/create-checkout-session
08:49:57:73
StripeInvalidRequestError: No such customer: 'cus_Ldnmz0B2PogG3G'
at Function.generate (/var/task/node_modules/stripe/lib/Error.js:40:16)
at res.toJSON.then.StripeAPIError.message (/var/task/node_modules/stripe/lib/StripeResource.js:220:35)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
type: 'StripeInvalidRequestError',
raw: {
code: 'resource_missing',
doc_url: 'https://stripe.com/docs/error-codes/resource-missing',
message: "No such customer: 'cus_Ldnmz0B2PogG3G'",
param: 'customer',
request_log_url: 'https://dashboard.stripe.com/logs/req_S6QaeJX8KS9p6W?t=1676965798',
type: 'invalid_request_error',
headers:
(...)
Went to Supabase Customers table and such customer does exist. However, went to Stripe and same customer has different ID ( cus_Ldnmz0B2PogG3G (supa) | cus_Lcv81isFjuOfPL (stripe) ) so I understand Supabase and Stripe are not in sync.
I will review the URLs used between the two (I have a pantallaverde.vercel.app as well as a custom domain pantallaverde.co), not sure if it is related or not but I will keep trying and will document the solution if found.
@andriusmv Is cus_Ldnmz0B2PogG3G
potentially a test mode customer?
@andriusmv Is
cus_Ldnmz0B2PogG3G
potentially a test mode customer?
@thorwebdev yes it is. however, I tried with a random new customer and had the same issue.
I tried with a random new customer and had the same issue.
The same error message in Vercel?
In my case upgrading all packages solved my issue.
@thorwebdev Different error message in Vercel this time (with 2 new customers):
StripeInvalidRequestError: No such price: 'price_1M4Sk7DMbjvTSNWqzQjPugRm'; a similar object exists in test mode, but a live mode key was used to make this request.
So it seems I'm mixing the wrong Stripe keys in prod, maybe?
However I just double checked. Keys are Ok. I can see that Stripe is not updating/replacing the Live products for the Test products in Supabase.
@thorwebdev Different error message in Vercel this time (with 2 new customers):
StripeInvalidRequestError: No such price: 'price_1M4Sk7DMbjvTSNWqzQjPugRm'; a similar object exists in test mode, but a live mode key was used to make this request.
So it seems I'm mixing the wrong Stripe keys in prod, maybe? However I just double checked. Keys are Ok. I can see that Stripe is not updating/replacing the Live products for the Test products in Supabase.
@thorwebdev SOLVED ✅ thank you!
☞ Mistake 1: When going live, I did not archive test products first. I clicked on "Copy to live mode" option, which then caused trouble. ☞ Solution: I created a new product (in live mode), then refreshed Products table in Supabase and boom, there it was.
Note for my future self and other folks arriving to this issue: for going live make sure you: ✔️ Archive test products before going live. ✔️ Do NOT "Copy to live mode" option in Stripe. It might cause trouble with your webhook. ✔️ Create your products from scratch in live mode. ✔️ Double check that you have the correct environment variables (with the live mode ones). ✔️ Verify package.json versions (or at least match the repo versions).
☞ If you think there should be another check please let the others know here.
Works perfectly in test mode, however, switching the keys prevents the stripe payment page from opening. Anyone else have this issue?
Blank pop up alert:
Console is throwing this error:
Failed to load resource: the server responded with a status of 500 ()