I want to allow the user to share something on facebook from my angular app. I forked mrt:spiderable-ui-router because the spiderable version seemed to be outdated and also not to work on windows. After doing that I got the following script in my temp dir:
var url = "http://localhost:23641/";/**
* Created by Marc on 09.12.2015.
*/
// 'url' is assigned to in a statement before this.
var page = require('webpage').create();
var isReady = function () {
return page.evaluate(function () {
if (typeof Meteor === 'undefined'
|| Meteor.status === undefined
|| !Meteor.status().connected) {
return false;
}
if (typeof Package === 'undefined'
|| Package['ongoworks:spiderable'] === undefined
|| Package['ongoworks:spiderable'].Spiderable === undefined
|| !Package['ongoworks:spiderable'].Spiderable._initialSubscriptionsStarted) {
return false;
}
Tracker.flush();
return DDP._allSubscriptionsReady();
});
};
var dumpPageContent = function () {
var out = page.content;
out = out.replace(/<script[^>]+>(.|\n|\r)*?<\/script\s*>/ig, '');
out = out.replace('<meta name="fragment" content="!">', '');
console.log(out);
};
page.open(url, function(status) {
if (status === 'fail')
phantom.exit();
});
setInterval(function() {
if (isReady()) {
dumpPageContent();
phantom.exit();
}
}, 100);
When I run the generated file with phantom, I got the following error:
Error: Match error: Failed Match.OneOf or Match.Optional validation
http://localhost:23641/packages/check.js?9c4972d3f4fe56cd455d3022e70b5195e642fc41:66
http://localhost:23641/packages/mongo.js?69942a86515ec397dfd8cbb0a151a0eefdd9560d:337
http://localhost:23641/packages/mongo.js?69942a86515ec397dfd8cbb0a151a0eefdd9560d:369
http://localhost:23641/packages/lai_ddp-inspector.js?f6cea602764860121f9b614cb15e324750e59017:365
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1872
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3671
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1873
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:2211
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1874 in Template.lai:ddp-inspector:a
nonymous
http://localhost:23641/packages/tracker.js?7776276660c988c38fed448d8262b925dffb5bc3:349
http://localhost:23641/packages/tracker.js?7776276660c988c38fed448d8262b925dffb5bc3:237
http://localhost:23641/packages/tracker.js?7776276660c988c38fed448d8262b925dffb5bc3:589
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1882
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3536
http://localhost:23641/packages/lai_ddp-inspector.js?f6cea602764860121f9b614cb15e324750e59017:367
http://localhost:23641/packages/aldeed_template-extension.js?198fda9390ae7785a7535751677cd8247508c9eb:417 in runTempla
teHooks
http://localhost:23641/packages/aldeed_template-extension.js?198fda9390ae7785a7535751677cd8247508c9eb:366 in templateE
xtensionMasterHook
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3330
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3671
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3332
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3406
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1952 in fireCallbacks
http://localhost:23641/packages/tracker.js?7776276660c988c38fed448d8262b925dffb5bc3:615
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1953
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:2211
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1954
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1966
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:2011
http://localhost:23641/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:2310
http://localhost:23641/packages/lai_ddp-inspector.js?f6cea602764860121f9b614cb15e324750e59017:555
http://localhost:23641/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:777
http://localhost:23641/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:779
I checked all my “check” commands and none of them is called. I also tried to debug the app but without success because meteor.js:779 look like this
if (taskHandle.future) {
and is never reached.
Now I got 3 questions:
- how can I debug such errors?
- why is this happening only when the page is called via phantomjs?
- how can I solve the error?
Thanks in advance.