tstepro
tsteproβ€’2y ago

FormData in HttpAction

Hey guys, I'm trying to use formdata from the httpAction but unfortunately unable to. Seeing this error:
Not implemented: formData() for Request. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).
Not implemented: formData() for Request. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).
I suspect that calling this in a nodejs env wouldn't fix this πŸ€” . Some context: I'm trying to upload a file from F/E to convex using an http action with some extra metadata. I can probably stuff that metadata into a header for now but would rather not πŸ˜” Any thoughts around this?
8 Replies
lee
leeβ€’2y ago
Hi! I ran into this same error in my own app. Sorry about that. Let me see what I can do today to fix it.
sshader
sshaderβ€’2y ago
Yep you're totally right that this error message is misleading and switching to a node action won't help. As Lee said, we'll look into adding some support here. I was going to suggest using a JSON body, but then re-read that you're using this for uploading a file, so that wouldn't work.
lee
leeβ€’2y ago
@tstepro for your use-case, are you using a url-encoded form or a multi-part form? we can support both, but url-encoded forms are easier so we can ship that faster if it would help you.
tstepro
tsteproOPβ€’2y ago
I am using a multi-part form for this use case.
lee
leeβ€’2y ago
Okay cool. Gotta go implement that now πŸ™‚
tstepro
tsteproOPβ€’2y ago
Thank you @lee 😌 Hey @lee, when that’s done what will I need to do on my end to upgrade to that implementation?
lee
leeβ€’2y ago
@tstepro you can start using request.formData() now -- the implementation just finished deploying (no upgrade necessary, it should just work). i tested it in several ways, but you're the first customer to use it, so let me know how it goes!
tstepro
tsteproOPβ€’2y ago
You’re awesome Lee. Thank you πŸ™Œ Confirming with you that this works πŸ™ Thanks again for shipping this so fast πŸš€

Did you find this page helpful?