postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.87k stars 841 forks source link

The file specified in the Request Body is undefined #12427

Open its-ogawa opened 1 year ago

its-ogawa commented 1 year ago

Is there an existing issue for this?

Describe the Issue

I am using Postman to use a WebAPI with a jpeg file as an argument. I specified file in form-data, selected a jpeg file stored in the working directory, and sent it, but the console shows "file: undefined". I have read various articles and have set the working directory to "C:\Users\Username\Postman\files" and turned on the "Read files outside working directory" checkbox, but there seems to be another problem. However, there seems to be another problem. Interestingly, Insomnia seems to work. Can anyone solve this problem? Thanks in advance.

Steps To Reproduce

  1. Open the New Request tab.
  2. Fill in the URL of the API you want to upload the File to. Example written in FastAPI;
    @app.post("/test")
    async def test(file: UploadFile):
       print(file.filename)
       return file.filename
  3. In the Body tab, select "form-data".
  4. Select "file" for Type and choose a file for Value. (Files in the working directory are preferred.) 5. Press the Send button.
  5. Open the Console tab.
  6. Open the Request Expand and open the Request Body. It is listed as file: undefined.

Screenshots or Videos

Attached is a capture of a failed attempt with Postman and a successful attempt with Insomnia.

image

image

Operating System

Windows

Postman Version

10.19.7

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

### Tasks
dev-sharma-08 commented 1 year ago

Hi @its-ogawa, I see that apart from getting file as undefined, you are also facing ECONNRESET error, maybe that could be the real culprit. You can check this doc to resolve this error: https://support.postman.com/hc/en-us/articles/6346313956887-Fixing-an-ECONNRESET-error. After that please send a request to the same endpoint and let us know if the problem still persists.

its-ogawa commented 1 year ago

@dev-sharma-08 Thank you for your response.

I was alternately posting the API on insomnia and postman when I ran into the problem, but only postman fails, so I am thinking it is not a server, endpoint or VPN issue. Can you think of anything else?

However, to my surprise, after performing Create blank connection - Add request in postman, the same operation to run the API worked. The connection or request configuration is exactly the same as before, so I'm not sure what the cause is, but it has been resolved for the time being.

dorname commented 6 months ago

same problem for me

james-wilson-sp commented 2 months ago

We are getting the same problem here too. Anyone know of a fix? Thanks!

GeorgeFlorian commented 3 weeks ago

I'm also facing the same issue when trying to POST images. The connection is timed out after 20 seconds. image image image