polar product not found
Im getting a 500 error:
Uncaught Error: Uncaught Error: Product not found: <ID>
I've followed the https://www.convex.dev/components/polar docs step by step
14 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Guessing you have products in Polar that existed before you set up the Polar component. The component still needs a method for backfilling products.
Hmm actually it should at least upsert in these cases. I'll add that.
Nah, I remember why I didn't do this initially, it creates a state where things can slowly triggle in implicitly, but all of your read methods are still wrong, eg.,
getCurrentSubscription
would still show no subscription if the subscription existed before the component. It needs a proper backfill approach. Will look into this.thanks very much for the update man, ill try nuke my convex project and worst case i’ll resort to doing polar syncing in a nextjs webhook with fetchqueries for the time being, let me know if theres any updates from your end with this 🤝🏻
Nuking Convex won’t change it, would have to nuke Polar if that’s an option.
yup have also tried multiple new polar instances, same error
okay yeah the issue was backfilling products, i made sure to create a new polar instance but skipped the product creation in the onboarding until after ive set everything up in the convex/polar tutorial
Just to understand, you're creating a new Convex project and a new Polar project, and while onboarding with Polar to get keys and such, Polar walked you through product creation, which is why your products existed before the Convex project was running. Is that right?
Hadn't considered how their onboarding works, but this will be a super common occurrence if they include product creation. Component def needs to support it well in that case.
yeah thats exactly what happened, luckily theres an option to skip creating a product on Polar onboarding
Is there any way to add an existing product?
Need to add support for backfilling existing products and subscriptions
Even manually, with an internal function would get the job done in the short term imo. Until then I wonder if I can manually edit the db tables?
You absolutely can, in the data tab there's a drop down where you can select the polar component and see/edit tables
A good amount of fields get stored though
Added
syncProducts()
in 0.5.0: https://github.com/get-convex/polar?tab=readme-ov-file#syncproductsWow quick turnaround! Thanks a ton!
this function is at the bottom of documentation, I spent 2 hours going through my code, seeing what I was I doing wrong before I scrolled the entire docs and found it, we should mention it before the code of displaying products on site
https://github.com/get-convex/polar/pull/9
Merged, thank you!