#convex dodopayments component issue

11 messages · Page 1 of 1 (latest)

old tendon
#

Hey everyone
I’m testing the new https://www.convex.dev/components/dodopayments (DodoPayments integration) with Convex.

My setup:
Next.js + TypeScript
Convex + Clerk
DodoPayments official Convex component docs

Problem:
Inside my convex/dodo.ts, Convex doesn’t recognize ctx.db inside the identify callback.

TypeScript error:
Property 'db' does not exist on type 'GenericActionCtx<any>'

I’ve already tried adding:

  • import type { MutationCtx } from "./_generated/server"
  • explicit (ctx: MutationCtx)
  • running npx convex dev again and again

But Convex still doesn’t recognize ctx.db within identify.
Can anyone from the Convex team confirm the correct context type or best practice for using ctx.db inside DodoPayments identify?

thanks in advance.

Convex

Dodo Payments is your complete solution for billing and payments, purpose-built for AI and SaaS applications.

topaz hedge
#

Looks like the docs are a bit off, that identify function will always only get an action ctx, (it requires it to use ctx.runAction) which doesn't have db access. What you can do is make a query and call it from the identify function via ctx.runQuery().

old tendon
#

Got it! Thanks a lot 🙌
I’ll try using ctx.runQuery() as you suggested.

Also noticed another thing — in the docs example (convex/dodo.ts), the export line seems to appear twice.
Probably just a small typo.

Really appreciate the quick help — learned a lot from this!

hoary cedar
topaz hedge
#

ah yeah the ctx isn't passed through 🤦‍♂️

topaz hedge
#

This is maintained by the Dodo team, if you open an issue on their repo they can take it from there. The issues you've mentioned here all appear valid.

old tendon
#

Thanks for the immediate response.
i have reported the issues on their discord server

steady zephyr
#

Hey, all three issues are now resolved, ctx is now passed as the first parameter to all webhook handlers and the documentation has been corrected.

Thanks for reporting!

How do we get the docs updated on convex components page?

topaz hedge
steady zephyr