motz
motz•10h ago

Type error after upgrading to Convex 1.29 from 1.27

In my Next.js 16 project using Convex, after having updated to Convex 1.29.0 and successfully running bun convex dev, when wanting to build the Next.js project, the following type error occurs on every single instance of useQuery, prefetchQuery, fetchQuery, etc.
./src/app/host/[code]/host.tsx:20:30
Type error: Type '{ _type: "query"; _visibility: "public"; _args: { code: string; }; }' does not satisfy the constraint 'FunctionReference<"query">'.
Type '{ _type: "query"; _visibility: "public"; _args: { code: string; }; }' is missing the following properties from type 'FunctionReference<"query">': _returnType, _componentPath

18 | }: {
19 | roomId: Id<"rooms">
> 20 | preloadedRoom: Preloaded<typeof api.rooms.getRoomByCode>
| ^
21 | }) {
22 | /*
23 | * QUERIES
Next.js build worker exited with code: 1 and signal: null
error: script "build" exited with code 1
./src/app/host/[code]/host.tsx:20:30
Type error: Type '{ _type: "query"; _visibility: "public"; _args: { code: string; }; }' does not satisfy the constraint 'FunctionReference<"query">'.
Type '{ _type: "query"; _visibility: "public"; _args: { code: string; }; }' is missing the following properties from type 'FunctionReference<"query">': _returnType, _componentPath

18 | }: {
19 | roomId: Id<"rooms">
> 20 | preloadedRoom: Preloaded<typeof api.rooms.getRoomByCode>
| ^
21 | }) {
22 | /*
23 | * QUERIES
Next.js build worker exited with code: 1 and signal: null
error: script "build" exited with code 1
4 Replies
Convex Bot
Convex Bot•10h ago
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!
Owen
Owen•8h ago
I am also getting this issue but mine also says
node_modules/convex/dist/esm-types/server/api.d.ts:46:5
_componentPath: ComponentPath;
~~~~~~~~~~~~~~
'_componentPath' is declared here.
node_modules/convex/dist/esm-types/server/api.d.ts:46:5
_componentPath: ComponentPath;
~~~~~~~~~~~~~~
'_componentPath' is declared here.
And the error is throwing when I do something like
ctx.db.query(internal.x.y)
ctx.db.query(internal.x.y)
Have you had any luck debugging yet ? If youre still having issues I just changed my package.json to use convex 1.27.0 again and it atleast lets me continue to locally dev for now until I know whats up
motz
motzOP•8h ago
Very strange - and no, I haven't got it working yet (other than switching back to an older version of Convex) either
Tom Redman
Tom Redman•3h ago
Same here 👀
convex/users/mutations.ts:148:39 - error TS2345: Argument of type '{ _type: "action"; _visibility: "public"; _args: { userId: { readonly [x: number]: string; readonly length: number; __tableName: "users"; }; }; }' is not assignable to parameter of type 'SchedulableFunctionReference'.

Type '{ _type: "action"; _visibility: "public"; _args: { userId: { readonly [x: number]: string; readonly length: number; __tableName: "users"; }; }; }' is missing the following properties from type 'SchedulableFunctionReference': _returnType, _componentPath
convex/users/mutations.ts:148:39 - error TS2345: Argument of type '{ _type: "action"; _visibility: "public"; _args: { userId: { readonly [x: number]: string; readonly length: number; __tableName: "users"; }; }; }' is not assignable to parameter of type 'SchedulableFunctionReference'.

Type '{ _type: "action"; _visibility: "public"; _args: { userId: { readonly [x: number]: string; readonly length: number; __tableName: "users"; }; }; }' is missing the following properties from type 'SchedulableFunctionReference': _returnType, _componentPath
on a call that was working prior to 1.29.0: await ctx.scheduler.runAfter(0, api.mixpanel.identify, { userId: id }); May have to revert back to 1.28 for the time being. Could be a pnpm caching error? Going to try and blow out lock files & node_modules, and reinstall. @motz @Owen I sorted it out. - I had a file for nice ergonomics: convex/mixpanel.ts, (e.g. api.mixpanel.identify) - I also had a folder for utilities: convex/mixpanel/toEvent.ts, etc. I had a hunch maybe the new type updates were being confused by this. I moved my mixpanel.ts file into the mixpanel folder (convex/mixpanel/mixpanel.ts), renamed my function references api.mixpanel.mixpanel.identify, and it worked.

Did you find this page helpful?