I have a problem trying to do a vercel deployment where I also have to do Convex migrations along with it. It appears I have a chicken-&-egg problem : the deployment won’t run without the migrations, and the migrations won’t run without the deployment.
I try to do a deployment on vercel and it fails because of a validation that would not fail if the migrations were run successfully. But then when I try to put the migrations before running npx convex deploy in the command, that fails and complains that deploy is not running. The same behaviour can be seen when I try to run the migration locally via a command prompt.
Trying to run the migration first :
(base) tnadmin@MSI:~/dev/ventrack$ npx convex run migrations/add_weightage_to_questions:addWeightageToExistingQuestions --prod
✖ Failed to run function "migrations/add_weightage_to_questions:addWeightageToExistingQuestions":
Error: [Request ID: 19078c0ffcf1d01f] Server Error
Could not find function for 'migrations/add_weightage_to_questions:addWeightageToExistingQuestions'. Did you forget to run `npx convex dev` or `npx convex deploy`?
Trying to run deploy first :
(base) tnadmin@MSI:~/dev/ventrack$ npx convex deploy
You're currently developing against your dev deployment
blah (set in CONVEX_DEPLOYMENT)
Your prod deployment robust-lion-79 serves traffic at:
NEXT_PUBLIC_CONVEX_URL=https://blah2.convex.cloud
Make sure that your published client is configured with this URL (for instructions see https://docs.convex.dev/hosting)
? Do you want to push your code to your prod deployment blah2 now? Yes
✖ Schema validation failed
Document with ID "k9710t8s4n1gee1cr4bmv57gcn7dn0tn" in table "questionnaireQuestions" does not match the schema: Value does not match validator.
Path: .options[0]
Value: "Extremely Difficult (sole supplier)"
Validator: v.object({text: v.string(), weightage: v.float64()})
NextJs, vercel, node 18.19