Comments (3)
I encountered the same problem.
Could you please tell me if you solved it?
from node-run-middleware.
Hello,
I thinks it's because (if you take a look at the index.js of the module, function createRes), the Response object "emulated" by app.runMiddleware doesn't have a res.connection property. So if somewhere in a middleware crossed by the path given, you use req.connection.remoteAdress, connection will be undefined and that will cause this error.
If i'm not mistaken, try to run the same path inside a request middleware with req.runMiddleware. In this case, the req and res normal object will be used, and you shouldn't have this error because req.connection exists.
To solve your problem, you can try to add connection property manually in the options argument
app.runMiddleware('path/to/your/request', { connection: { remoteAddress: /fakeAdress/ } }, /callback/)
from node-run-middleware.
If you wish the create a fix, I will review and merge it.
from node-run-middleware.
Related Issues (20)
- Supports redirect HOT 1
- Add headers objects
- Can this be used with Router? HOT 3
- TypeError: Cannot read property 'pipesCount' of undefined HOT 11
- Small Error in Docs
- No mocha tests
- async/await usage HOT 2
- Remove Lodash depenedency HOT 1
- setting HTTP status during SSR fails HOT 2
- mocking fetch to use node-run-middleware under the hood
- add typescript support
- node-run-middleware and helmet or cors = errors HOT 6
- Add res.json(...) support - /w work around HOT 2
- Buffers / Stream
- .end() Doesn't work HOT 1
- Add an option to call to middleware by using req object HOT 1
- Disable the option to add as twice to the same app HOT 1
- Keep the headers and cookies from the current requests HOT 2
- Choose a better name and description HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-run-middleware.