RJR
Convex Community2y ago
11 replies
RJ

Unable to execute internal action from dashboard or CLI

I've got an internal action which I use to invite users to my application. It accepts some parameters (emailAddress and userRole) and coordinates with Clerk to send an invitation email and add the user to the DB with the correct role. It was intended to be run exclusively from the dashboard (or the CLI via convex run, though the dashboard is generally much easier). However, I'm running into some odd issues attempting to execute it by either method. See attached screen recording for what happens when I try to execute it via the dashboard. When I try to execute it via the CLI, I'm getting a validation error that I'm not sure I believe (scrubbed of some irrelevant data/PII):

$ pnpm doppler run --command="pnpm convex run --prod scripts/operational/inviteUser '{
  \"emailAddress\": \"name@website.com\",
  \"userRole\": { \"tag\": \"BrandPartner\", \"brandPartnerId\": \"xxx\" }
}'"
Using DOPPLER_CONFIG_DIR from the environment. To disable this, use --no-read-env.
✖ Failed to run function "scripts/operational/inviteUser":
Error: [Request ID: a802de57bfc6abaa] Server Error
ArgumentValidationError: Value does not match validator.
Path: .userRole
Value: {brandPartnerId: "xxx", tag: "BrandPartner"}
Validator: v.union(v.object({tag: v.literal("Internal")}), v.object({brandPartnerId: v.id("brandPartners"), tag: v.literal("BrandPartner")}), v.object({relationships: v.array(v.object({brandPartnerId: v.id("brandPartners"), retailer: v.union(...)})), tag: v.literal("SalesRep")}))
Was this page helpful?