You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I have the problem need help plz.
I have apollo-server-express 2.9 and the client send file there. Me need proxing this request to the other server.
BUT! i cann't do this and i have error GraphQLError: Error: socket hang up:(
EXAMPLE:
asyncmutationResolver(_,{contacts : { user_scans, ...otherData}},ctx){constgetFileData=async(filePromise)=>{const{ filename, mimetype, createReadStream }=awaitfilePromise;conststream=createReadStream();awaitnewPromise((res,rej)=>{stream.on('error',error=>{console.error('There was an error.');reject(error);}).on('end',()=>{res();}).resume();});return{value : stream,options : {
filename,contentType : mimetype,},};};// user_scans are promise files array from clientconstfileDataPromises=user_scans.map(getFileData);constfiles=awaitPromise.all(filedDataPromises);// swagger 2.0 does not understand file array and this hack needconstattachFiles=files.reduce((acc,file,index)=>{return{
...acc,[`user_scan_${index+1}`] : file,};},{});constformData={
...otherData,
...attachFiles,};// customRp is request-promise with deafult headersconstresponse=awaitcustomRp({uri : myOtherServerURL,method : 'POST',
formData,});}
And i have error GraphQLError: Error: socket hang up. But if i send files with fs.createReadStream('./file1.jpg') it WORKS!(
Sorry if that not for you issue, but i can not find solve. but probarly you will give hint to me/
ps. sorry for my bad english
The text was updated successfully, but these errors were encountered:
I'm sorry, but this looks like a usage question that might be better suited for Stack Overflow or another discussion forum.
without saving locally
As a tip, you will not be able to avoid the temp file being created via fs-capacitor, you can read about the architecture here.
Your code is a little confusing to me, so I won't comment on your situation exactly but you should be able to figure out how to stream files out to another server; that is how most of us are processing file uploads. I stream my files up to DigitalOcean Spaces.
Of course, if you find a specific bug with minimal reproduction steps we can reopen.
thank you! i found explain in this issue form-data/form-data#394
trouble was be with compatibility between stream from fs-capacitor and form-data which used to request.js underhood as I understand
Hello! I have the problem need help plz.
I have apollo-server-express 2.9 and the client send file there. Me need proxing this request to the other server.
BUT! i cann't do this and i have error GraphQLError: Error: socket hang up:(
EXAMPLE:
And i have error GraphQLError: Error: socket hang up. But if i send files with
fs.createReadStream('./file1.jpg')
it WORKS!(Sorry if that not for you issue, but i can not find solve. but probarly you will give hint to me/
ps. sorry for my bad english
The text was updated successfully, but these errors were encountered: