Http functions file upload - error since January 1, 2022

Hi,
I have a http function that I use to automatically upload files to my wix web site. It used to work until January 1 2022 and then something changed in WIX and the function is failing now. I have other http functions that work properly but they do not process files - just json.

My external script that invokes the function:

with open (path, “rb” ) as f:
im_bytes = f.read()

im_b64 = base64.b64encode(im_bytes).decode( “utf8” )

json = {
‘id’ : id,
‘fileName’ : fileName,
‘image’ : im_b64
}

request = requests.post(url_post,json = json)
print (request)
print (request.text)

and the http function in wix

return request . body . json ()
. then (( body ) => {
// update the item in a collection

  **let**  buffer  =  body [ 'image' ]; 

#it starts failing at the next line of code
#accessing the buffer variable in any way
#even if only console.log(buffer)
let imgBuffer = Buffer . from ( buffer , “base64” );
}

<Response [500]> {“error”:{“message”:“Request failed with status code 500”,“name”:“Error”,“stack”:“Error: Request failed with status code 500\n at createError (/dynamic-modules/edm_root/c57a7630-7029-11ec-b0e9-09936679173d/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/dynamic-modules/edm_root/c57a7630-7029-11ec-b0e9-09936679173d/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/dynamic-modules/edm_root/c57a7630-7029-11ec-b0e9-09936679173d/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (events.js:327:22)\n at IncomingMessage.EventEmitter.emit (domain.js:529:15)\n at endReadableNT (internal/streams/readable.js:1327:12)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)”,“config”:{“url”:“HAD_TO_REMOVE_THE_LINK_TO_BE_ABLE_TO_POST_HERE”,“method”:“post”,“data”:{“_overheadLength”:285,“_valueLength”:21285,“_valuesToMeasure”:[],“writable”:false,“readable”:true,“dataSize”:0,“maxDataSize”:2097152,“pauseStreams”:true,“_released”:true,“_streams”:[],“_currentStream”:null,“_insideLoop”:false,“_pendingNext”:false,“_boundary”:“--------------------------799081772552681895303725”,“_events”:{},“_eventsCount”:1},“headers”:{“Accept”:“application/json, text/plain, /”,“Content-Type”:“application/x-www-form-urlencoded”,“User-Agent”:“axios/0.21.4”},“transformRequest”:[null],“transformResponse”:[null],“timeout”:0,“xsrfCookieName”:“XSRF-TOKEN”,“xsrfHeaderName”:“X-XSRF-TOKEN”,“maxContentLength”:-1,“maxBodyLength”:-1,“transitional”:{“silentJSONParsing”:true,“forcedJSONParsing”:true,“clarifyTimeoutError”:false},“isSSR”:false}}}

The code chuck you posted is not enough. It is too short. And the part before and after are missing.

This appears to be the same issue reported in the post “mediaManager Upload returns error”.
We are still waiting to hear from Wix Support.

I am also facing the http functions file upload - error since January 1, 2022 and I don’t know why. That is why I was searching for the solution online and I am so happy I found your post where I found my answer. I also found https://www.topessaywriting.org/samples/philosophical-concepts website where I can easily read essay samples and the best thing is I don’t have to pay anything to read them.