Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Issue with formidable package inside of faunadb npm module #8

Open
mrispoli24 opened this issue Jun 11, 2019 · 3 comments
Open

Issue with formidable package inside of faunadb npm module #8

mrispoli24 opened this issue Jun 11, 2019 · 3 comments

Comments

@mrispoli24
Copy link

I found an issue when trying to run this where I receive the error:

WARNING in ../node_modules/formidable/lib/incoming_form.js 1:43-50
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

The fix for me was to add a webpack.functions.js file to the root with the following:

const webpack = require('webpack');

module.exports = {
  plugins: [ new webpack.DefinePlugin({ "global.GENTLY": false }) ]
};

In package.json the serve and build commands needed to add this per the documentation.

"dev:server": "netlify-lambda serve functions --config ./webpack.functions.js",
"netlify:build:lambda": "netlify-lambda build functions --config ./webpack.functions.js"

This allowed this to compile properly without the error. Not sure if something changed in the formidable package or if anyone else has come across this.

@iamtekeste
Copy link

@mrispoli24 Thank you so much for this! I was pulling my hair out for a couple of hours!!

@codeth
Copy link

codeth commented Aug 10, 2020

@mrispoli24 Another grateful dev here, thank you for documenting this! Problem solved.

In my case it was the same issue with formidable, but from auth0 rather than faunadb.

I had been successfully using Netlify Dev to serve some self-contained functions locally (with no build steps) and had just set up netlify-lambda so that I could build them from TypeScript source files instead. On building, I got the following warning:

WARNING in ../node_modules/formidable/lib/incoming_form.js 1:43-50
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ../node_modules/formidable/lib/index.js
 @ ../node_modules/superagent/lib/node/index.js
 @ ../node_modules/rest-facade/src/Client.js
 @ ../node_modules/rest-facade/src/index.js
 @ ../node_modules/auth0/src/auth/index.js
 @ ../node_modules/auth0/src/index.js
 @ ./image-signature.ts

Using the application resulted in the same error TypeError: n is not a function as reported by others on netlify/netlify-lambda#64.

@byungjuJin
Copy link

superagent need to upgrade formidable
Please check out below

ladjs/superagent#1609
node-formidable/formidable#337

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

No branches or pull requests

4 participants