Open patricklehmann opened 10 years ago
@patricklehmann I'm having this same issue. Did you ever resolve it?
Sorry for my late reply. Is this happening in a prerender project? The prerender-mongodb-cache is supposed to run as a plugin of it.
@lammertw Yes, I have a prerender.io deployed to Heroku, prerender-mongodb-cache installed, and MongoLab added on to the heroku instance. Confirm my prerender server works with plugins disabled. My server.js
looks like:
var prerender = require('./lib')
var server = prerender({
workers: process.env.PHANTOM_CLUSTER_NUM_WORKERS,
iterations: process.env.PHANTOM_WORKER_ITERATIONS || 10,
phantomBasePort: process.env.PHANTOM_CLUSTER_BASE_PORT || 12300,
messageTimeout: process.env.PHANTOM_CLUSTER_MESSAGE_TIMEOUT
});
// server.use(prerender.basicAuth());
server.use(prerender.whitelist());
server.use(prerender.blacklist());
// server.use(prerender.logger());
server.use(prerender.removeScriptTags());
server.use(prerender.httpHeaders());
// server.use(prerender.inMemoryHtmlCache());
// server.use(prerender.s3HtmlCache());
server.use(require('prerender-mongodb-cache'));
server.start();
This immediately causes a node crash when requesting a URL:
2014-08-04T20:51:37.021706+00:00 app[web.1]: getting http://truth.qurr.us
2014-08-04T20:51:38.044845+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/http://truth.qurr.us" host=om-prerender.herokuapp.com request_id=54a917ec-f04f-4c96-8fb7-b6b1400c2ea7 fwd="67.86.245.241" dyno=web.1 connect=2ms service=1026ms status=503 bytes=615
2014-08-04T20:51:38.033351+00:00 app[web.1]: throw er; // Unhandled stream error in pipe.
2014-08-04T20:51:38.038450+00:00 app[web.1]: at next (/app/lib/server.js:54:13)
2014-08-04T20:51:38.038444+00:00 app[web.1]: at Object.module.exports.afterPhantomRequest (/app/node_modules/prerender-mongodb-cache/lib/mongoCache.js:38:39)
2014-08-04T20:51:38.033424+00:00 app[web.1]: ^
2014-08-04T20:51:38.046080+00:00 app[web.1]: worker 2 died.
2014-08-04T20:51:38.038449+00:00 app[web.1]: at next (/app/lib/server.js:54:13)
2014-08-04T20:51:38.038446+00:00 app[web.1]: at next (/app/lib/server.js:52:20)
2014-08-04T20:51:38.032200+00:00 app[web.1]:
2014-08-04T20:51:38.038463+00:00 app[web.1]: at /app/lib/server.js:313:19
2014-08-04T20:51:38.038447+00:00 app[web.1]: at next (/app/lib/server.js:54:13)
2014-08-04T20:51:38.038455+00:00 app[web.1]: at Object.server.onPageEvaluate (/app/lib/server.js:362:14)
2014-08-04T20:51:38.038440+00:00 app[web.1]: TypeError: Cannot read property 'url' of undefined
2014-08-04T20:51:38.038465+00:00 app[web.1]: at Proto.apply (/app/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:123:13)
2014-08-04T20:51:38.038452+00:00 app[web.1]: at next (/app/lib/server.js:54:13)
2014-08-04T20:51:38.038453+00:00 app[web.1]: at Object.server._pluginEvent (/app/lib/server.js:59:5)
2014-08-04T20:51:38.032512+00:00 app[web.1]: stream.js:94
2014-08-04T20:51:38.047592+00:00 app[web.1]: Restarting worker thread...
2014-08-04T20:51:38.426993+00:00 app[web.1]: Server running on port 20049
2014-08-04T20:51:38.413372+00:00 app[web.1]: starting phantom
2014-08-04T20:51:38.774500+00:00 app[web.1]: started phantom
Any help is greatly appreciated. Thanks!
I think it might be because of changes in the prerender code. I recently merged a pull request that also fixed compatibility issues. I haven't had much time lately to work on this myself but hopefully next weekend I'll get some time to work on my own project in which I'm using it and I'll bring it up to date with the latest prerender version and also mention in the README with which version it's compatible.
@lammertw I was able to get it working simply by forking lammertw/prerender-mongodb-cache.git to outrightmental/prerender-mongodb-cache.git and (without making any changes to your latest code) specifying the latter URL manually in the package.json I pushed to my Heroku app. Perhaps the only blocker is pushing the latest code to NPM?
Hey there, i just added prerender-mongodb-cache to my application and all i get is a Cannot read property 'url' of undefined. Can someone help me?
these are my dependencies... "dependencies": { "lodash": "~2.4.0", "cache-manager": "0.2.0", "aws-sdk": "~1.13.0", "phantom": "~0.5.7", "phantomjs": "~1.9.7-1", "prerender-mongodb-cache": "0.0.1" },
thanks a lot!! kind regard, patrick