Formidable and form packages
See original GitHub issueBug report
Describe the bug
I was on Next.js v8 with a monorepo, but am now upgrading to v9 with all endpoints moved to the new pages/api/
feature. But now any of my post endpoints that include file uploading do not work. I tried to simplify the reproduction as much as possible, not even worrying about the API endpoint resolving.
The problem is that the Formidable parse
never seems to finish. I also tried Tim’s urlencoded-body-parser
as alternative, but it seems to hang also.
A clear and concise description of what the bug is.
To Reproduce
Micro endpoint in pages/api/endpoint.js
:
const { run } = require("micro");
const formidable = require("formidable");
const endpoint = async (req, res) => {
const data = await new Promise(function(resolve, reject) {
const form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
if (err) return reject(err);
resolve({ fields, files });
});
});
};
module.exports = (req, res) => run(req, res, endpoint);
Client-side post in pages/index.js
:
const response = await fetch(url, {
body,
credentials: "include",
headers: {
Authorization: JSON.stringify({ token })
},
method: "POST"
});
Expected behavior
That the parse
would finish and data
would be assigned.
Screenshots

System information
- OS: macOS
- Browser: Chrome
- Version of Next.js: 9.0.1
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Formidable - npm
A Node.js module for parsing form data, especially file uploads. Code style codecoverage linux build status windows build status macos build ...
Read more >Formidable Forms - The Most Advanced WordPress Forms ...
Formidable Forms is the best WordPress forms plugin. Over 300000 professionals use our WordPress form builder to create contact forms, surveys, calculators, ...
Read more >Formidable Forms Pricing, Packages & Plans 2022 - G2
Formidable Forms Pricing ; Lite. $0.00. Build beautiful contact forms with all the basic fields. Unlimited forms; Unlimited users; Unlimited form ...
Read more >Formidable and form packages #7947 - vercel/next.js - GitHub
Bug report Describe the bug I was on Next.js v8 with a monorepo, but am now upgrading to v9 with all endpoints moved...
Read more >Uploading Files using Formidable in a Node.js Application
As mentioned previously, formidable is a Node.js module for parsing form data, especially file uploads. Let's start by installing formidable.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i think you need to add to pages/api/endpoint.js:
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.