pbojinov / request-ip

A Node.js module for retrieving a request's IP address on the server.
https://npmjs.com/package/request-ip
MIT License
828 stars 102 forks source link

Incompatible with Next.js middleware/Vercel edge functions #63

Closed richardweaver closed 2 years ago

richardweaver commented 2 years ago

I'm using the library to enable IP whitelisting for a Next.js app hosted on Vercel. This causes a build error:

Failed to compile.

../../node_modules/is_js/is.js
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Middleware middleware

Import trace for requested module:
../../node_modules/request-ip/dist/index.js
./middleware.ts

This is this module's only dependency, can this import be dropped in favour of lightweight equivalents?

pbojinov commented 2 years ago

We can definitely drop the dependency in favor or a lightweight equivalent. Thanks for submitting the PR, I'll take a look.

pbojinov commented 2 years ago

Resolved in https://github.com/pbojinov/request-ip/issues/63