Uncaught Error: ENOENT: no such file or directory
Can someone help me point out my mistake on my code.
I'm trying to load the url from PDFLoader from LangChain and I'm getting an error in the Convex Dashboard says no such file or directory
20 Replies
new PDFLoader()
expects a file path, not a url
If it supports blobs you can generate one with ctx.storage.get()
, not sure if it does though
Actually it doesn't look like blobs are supportedis there any way to get around this?
Forking the repo and swapping out fs for blob support :/
https://github.com/langchain-ai/langchainjs/issues/784
I don't know much about LangChain, maybe you could have a small service outside of Convex that does just this part?
For sure, let me try to play it around a little bit. It actually worked before I just changed the code, maybe I'll bring the old code back and compare it.
Interesting, would love to see how this was working
I found a way, I don't know if this is the most efficient solution tho 😆
okay so blobs are supported?
weird
(and great!)
you should be able to just skip the url part and get the blob direct from convex then
ctx.storage.get()
accepts the file id and returns a blob
It's mentioned here: https://docs.convex.dev/file-storage/serve-files#serving-files-from-http-actionsI actually tried that but it still gave me the same error
same error about file system access?
yup exactly the same
Did you do
ctx.storage.get()
or ctx.storage.getUrl()
I did both
same error as in both printed a convex url?
yes, but let me try again just to make sure.
yeah
get()
shouldn't be returning a string, let alone a url: https://docs.convex.dev/api/interfaces/server.StorageActionWriter#getInterface: StorageActionWriter | Convex Developer Hub
server.StorageActionWriter
Were you passing
fileUrl
to get()
by chance? It needs the file id rather than the urlthat's weird the
ctx.storage.get()
works now, it wasn't working beforeI'm glad the loader supports it! It isn't documented to do so.
I'm always thankful for your support @erquhart 🙏