handling file type, and a small issue with a server package
Issue #1: I was trying to use the file system from google seen here -> google docs, in which I have a file called
model.ts
that already has some working structure (using async functions and convex built in functions), but when I try importing the GoogleAIFileManager
I ran through this error:
and after further investigation, this could be the possible soultion -> some guy on github threads
which I thought I'm already am?
I know my code is complaing about the second line here:
so what would you suggest in this case? do I wrap it in an action and not use it in another file?
Issue #2: I would like to pass my file as a file type to pass it through the google function that handles it for me without having to upload it somewhere or add to my cache history, and the code happend to complain that I used v.any()
instead of defining it as a file like i did, what do I do in this case as a suggestion?
what should I do in this case?Google for Developers
Prompting with media files | Gemini API | Google for Developers
GitHub
Googleapis return "Module not found: can't resolve fs" when running...
Thanks for stopping by to let us know something could be better! PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. ...
2 Replies
Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
usually means you want "use node"
at the top of your Convex file that's using whichever node module it's complaining about (and also make sure there aren't any non "use node" files importing the "use node" ones).
So yeah, "do I wrap it in an action and not use it in another file?" sounds about right.
Re: the error about supported Convex types, all Convex functions must take in and return Convex Values (which are basically a subset of JSON). So you can't directly pass in a File object to a Convex function. I'm not familiar with this library, but I'd look into if there's some way to pass around some metadata (e.g. a file ID) that you could use to rehydrate the File object inside your Convex functionso the
"use node"
part seemed to be working indeed! and I worked out the file type part too, so thanks!