Back

Sending a base64 encoded image (as string) to an appwrite function, using the js web sdk

  • 0
  • Functions
  • Web
Sonicviz
19 Feb, 2024, 01:06

Does anyone have any examples of successfully sending a base64 encoded image (as string) to an appwrite function, using the js web sdk? I don't think there is a size limit on the function parameters, but I keep getting either JSON econoding errors (on base64 image that is tested to be ok via https://base64.guru/converter/decode/image - removed the data:/;base64, from the result first ) or just a mysterious function error response console message "An internal curl error has occurred within the executor! Error Msg: Http invalid protocol\nError Code: 500"

A working example of sending a base64 encoded image (as string) to an appwrite function would be really helpful, as I can quickly compare more easily to see what might be the problem. I've tested with shorter strings in place of the base64 encoded image, as well as truncated base64 image strings, which seem to be accpeted. The issue appears when I use a complete base64 image encoded string.

And yes, I need to send the actual image to the function for use case reasons, not upload to storage first and retrieve it from there, so that's not an option. I keep reading in threads like this https://appwrite.io/threads/1160583345877569627 recommending that you upload the image to storage first, but this is not an option, and is a big friction point. It is much more optimal for certain use cases to upload the image directly to the function to process, for multiple reasons. Is this possible to do at all, or is it true that basically appwrite functions cannot handle this use case?

Thanks!

TL;DR
Developers are facing issues sending a base64 encoded image as a string to an appwrite function using the JS Web SDK. Errors include JSON encoding errors and a mysterious internal curl error with code 500. The developer needs a working example to compare and resolve the issue. Uploading the image to storage first is not an option due to specific use case requirements.
Steven
19 Feb, 2024, 01:40

Where are you seeing the error?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more