Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forwarding upload to another service times out (ECONNRESET) #259

Closed
sevetseh28 opened this issue Sep 8, 2021 · 7 comments
Closed

Forwarding upload to another service times out (ECONNRESET) #259

sevetseh28 opened this issue Sep 8, 2021 · 7 comments

Comments

@sevetseh28
Copy link

sevetseh28 commented Sep 8, 2021

Hi! I have a webserver acting as a gateway using NestJS and I successfully implemented a Mutation accepting a file with this package (graphql-upload).

The problem I'm currently having is that after accepting the file upload I wanna reupload that file to another service by doing the following HTTP call:

async uploadImage(
    userId: string,
    uploadData: ImageUploadArg,
  ): Promise<{ id: string }> {
    const imgFileUpload: FileUpload = await uploadData.imageFile;
    let data = new FormData();
    data.append('prefix', uploadData.prefix);
    data.append('category', uploadData.category);
    const readStream = imgFileUpload.createReadStream();
    data.append('image', readStream, imgFileUpload.filename);
    return this.httpService
      .post(
        `${this.configService.get('anotherServiceURL')}/${userId}/images`,
        data,
        {
          headers: {
            ...data.getHeaders()
          },
          maxBodyLength: Infinity,
          maxContentLength: Infinity,
        },
      )
      .toPromise()
      .then((res) => {
        return res.data;
      })
  }

Problem is that when calling the http service, it times out with an ECONNRESET error. I am assuming there's something wrong with the read Stream generated by this package. Any ideas?

Im using

  • Node 14.15.3
  • graphql-upload 12.0.0
  • NestJS 8 with the in-built graphql upload disabled (therefore im using this package directly as middleware)

Thank you!

@jaydenseric
Copy link
Owner

Closing because we only keep issues open here that describe a specific graphql-upload bug, or request a new feature. If anyone would like to assist in debugging this problem or has a suggestion, feel free to comment! Also, if you figure it out you're welcome to comment what worked in case it helps others in a similar situation.

@sevetseh28
Copy link
Author

sevetseh28 commented Sep 8, 2021

But isnt it possible that this is an actual bug with graphql-upload? Why did you rule it out immediately? Knowing that might help me to debug it. Thanks!

(for instance: #170)

@jaydenseric
Copy link
Owner

The way open source works is you debug your own project, and find out if it's a graphql-upload bug. When you are sure it is, then you report it here. What doesn't work, is expecting me to debug your project code (which I don't have easy access to, or a full understanding of) to find out if it's a graphql-upload bug, and pay me nothing when it's not.

The last graphql-upload bug was found in 2019, and since then the package has been installed > 83 million times. People still raise issues asking for help with their projects though. Sometimes a graphql-upload user is stuck on something easy for me to spot and help with and so I do, sometimes not. Either way, the issue is with the project not graphql-upload so it gets closed.

@sevetseh28
Copy link
Author

sevetseh28 commented Sep 9, 2021

The way open source works is you debug your own project, and find out if it's a graphql-upload bug. When you are sure it is, then you report it here. What doesn't work, is expecting me to debug your project code (which I don't have easy access to, or a full understanding of) to find out if it's a graphql-upload bug, and pay me nothing when it's not.

The last graphql-upload bug was found in 2019, and since then the package has been installed > 83 million times. People still raise issues asking for help with their projects though. Sometimes a graphql-upload user is stuck on something easy for me to spot and help with and so I do, sometimes not. Either way, the issue is with the project not graphql-upload so it gets closed.

I'm sorry Jayden but I think your attitude is not right
at all and you are overreacting. I'm sorry if I didn't debug it enough but the way open source works is helping out the community and don't expect getting paid by doing so. I never expected you or anyone to debug it for me either.

It's sad to see such a reaction and response. Anyhow, thank you.

@ivoilic
Copy link

ivoilic commented May 9, 2022

@sevetseh28 Did you ever resolve this? I'm having the same issue. I've tried many variation but it always seems to come back to something being off with the stream itself.

@jaydenseric
Copy link
Owner

@ivoilic make sure that your sever (i.e. Apache or NGINX) config has limits greater than those configured for graphql-upload, and make sure that you are promisifying and awaiting the end of the file upload streams in resolvers.

@jaydenseric
Copy link
Owner

jaydenseric commented Sep 12, 2024

Edit: Sorry, replied in the wrong issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants