Coder Social home page Coder Social logo

Comments (9)

soapproject avatar soapproject commented on June 11, 2024 4

Face the same issue today, but it turned out I forget to disable the nextjs bodyParser.

export const config = {
  api: {
    bodyParser: false,
  },
};

from formidable.

richard-here avatar richard-here commented on June 11, 2024 2

I have found the main issue for my case. It wasn't because of the Node version or the Express version, but instead on which I ran my Express app: Google Cloud Functions.

It turns out that Google Cloud Functions implement some middleware that converts inputs that are files into raw data type (Buffer) in req.rawBody (full description here: https://stackoverflow.com/a/47319614). It seems that Formidable requires the data type unmodified, and as the data is automatically modified when running on an Express app on Google Cloud Functions, I concluded that my case is not the right use case to use Formidable.

At the same time, I tried running Formidable on a regular Express app and it worked with the Node version I provided in the original issue submission.

For others facing the same issue, you can instead parse the raw data using Busboy.

from formidable.

GrosSacASac avatar GrosSacASac commented on June 11, 2024 1

related #594

from formidable.

eschaefer avatar eschaefer commented on June 11, 2024

Just came here with the exact same use case. The callback never resolves, no error either.

Just to make it simpler without all the postman/insomnia UI:

curl --request POST \
  --url <my url> \
  --header 'Content-Type: multipart/form-data' \
  --form field1=eee \
  --form field2=text

Results in parse hanging.

from formidable.

GrosSacASac avatar GrosSacASac commented on June 11, 2024

Try again with node v20, and without express

from formidable.

eschaefer avatar eschaefer commented on June 11, 2024

@GrosSacASac just curious but... why? The docs say node > 10.13 is supported, and there is explicit express integration support in the docs.

from formidable.

GrosSacASac avatar GrosSacASac commented on June 11, 2024

Yes, but first of all we need to find the source of the problem.

Since it works for me (I just tested the curl example) I conclude that it must something that we have different. which is node version or express.

Once we find the source of the problem we can try to find the solution or update the docs

from formidable.

GrosSacASac avatar GrosSacASac commented on June 11, 2024

Next time test locally before making an issue.

Someone made https://github.com/Amit-A/formidable-serverles that uses req.rawBody. I am not sure that it is a clean solution.

from formidable.

JulianKingman avatar JulianKingman commented on June 11, 2024

Sorry to resurrect this, but shouldn't formidable throw some kind of error if it can't parse the request? Would a PR exposing the error be accepted? Could blow things up, but it's better than silent failure.

from formidable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.