Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript errors when using spiderable with observatory #30

Open
rantav opened this issue Oct 9, 2013 · 1 comment
Open

Javascript errors when using spiderable with observatory #30

rantav opened this issue Oct 9, 2013 · 1 comment

Comments

@rantav
Copy link

rantav commented Oct 9, 2013

Hi, it seems that there are errors when adding spiderable to a project that uses observatory. More specifically, running phantomjs with observatory.
Spiderable uses phantomjs.
Opening a meteor site that uses observatory with phantomjs results in js errors.
TypeError: 'undefined' is not a function (evaluating 'this._emitWithSeverity.bind(this,o)')

I can't say I found the exact reason, but repro seems to be 100%. Maybe it's related to some user agent magic or something in phantomjs's javascript agent or the way it handles network connections or something, but anyway I get the error when deploying a simple meteor site and adding only two packages: spiderable (which before adding observatory works) and then observatory.

$ mrt create test
$ cd test
$ mrt add spiderable
$ mrt deploy testing123xxx.meteor.com

$ curl http://testing123xxx.meteor.com/?_escaped_fragment_=
>> OK (page gets rendered)

$ mrt add observatory
$ curl http://testing123xxx.meteor.com/?_escaped_fragment_=
>> timeout. (15 secs later we get a JS bare page instead of an HTML page)

Now writing a phantomjs script and running it shows the actual JS errors

Here's the phantomjs script (copied from spiderable):

var url = "http://testing123xxx.meteor.com/";
var page = require('webpage').create();
page.open(url);
setInterval(function() {
var ready = page.evaluate(function () {
  if (typeof Meteor !== 'undefined'         &&
      typeof(Meteor.status) !== 'undefined'         &&
      Meteor.status().connected) {
        Deps.flush();
        console.log(5);
      return DDP._allSubscriptionsReady();
}
return false;
});
if (ready) {    var out = page.content;
out = out.replace(/<script[^>]+>(.|\n|\r)*?<\/script\s*>/ig, '');
out = out.replace('<meta name="fragment" content="!">', '');
console.log(out);
phantom.exit();
}}, 100);

And now:

$ phantomjs my-phantom-script
TypeError: 'undefined' is not a function (evaluating 'this._emitWithSeverity.bind(this,o)')

I have also tried this with mrt deploy --debug and the same error happens.

Again, I don't see the direct connection (in a regular browser that's OK) but in phantomjs I definitely see the errors and it's 100% repro.

@JohnAllen
Copy link

What was the cause of this? I'm getting something similar, locally that is. Testing Phantom + Spiderable before pushing to production.

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

No branches or pull requests

2 participants