You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're notifying you about a Convex change which we've detected may affect your project(s).
In Convex 1.18, we introduced a warning when calling Convex queries, mutations, and actions directly as JavaScript functions. See https://news.convex.dev/announcing-convex-1-18/ for more details.
If you are calling such functions directly, it should appear as a console.warn log line coming from the function. In the near future, with Convex 1.21, the pattern is becoming a TypeScript error. That means npx convex dev and npx convex deploy (with typecheck enabled) will fail to push code if the pattern is used.
Use ctx.runMutation, ctx.runQuery, or ctx.runAction instead of calling the function directly. This has more overhead (it's slower) but you gain isolation and atomicity because it runs as a subtransaction.
If you need to push without fixing the code, there are two quick options:
Push code with the --typecheck disable flag, or cast to any to appease TypeScript. For [email protected] the function call will continue to work at runtime, even though it doesn't typecheck. In a future version it may stop working entirely.
Delay upgrading to [email protected]. The pattern will continue to work in TypeScript and at runtime on 1.20 and below.
Please reach out in Discord if you have any questions about this change or difficulty migrating. Alternatively, you can create a support ticket if you're a Convex Pro customer.
To Reproduce
Run pnpm test
Observe Convex warnings.
Expected behavior
Convex functions are not called directly from other Convex functions. There are no warnings.
Screenshots
Additional context
We may need to create helper functions to manage shared behavior.
The text was updated successfully, but these errors were encountered:
Describe the bug
Currently we're directly calling Convex functions from other Convex functions. This produces warnings. Queries and mutations should be rewritten to avoid doing this, see: https://docs.convex.dev/understanding/best-practices#use-helper-functions-to-write-shared-code
Additionally:
To Reproduce
pnpm test
Expected behavior
Convex functions are not called directly from other Convex functions. There are no warnings.
Screenshots

Additional context
We may need to create helper functions to manage shared behavior.
The text was updated successfully, but these errors were encountered: