Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use spiderable with a meteor app hosted on modulus.io

I'm trying to make spiderable works on my meteor app hosted on modulus with SSL. I have Meteor 1.0, iron:router 1.0, spiderable and node package of phantomjs

All is working on localhost. But once I deploy on Modulus, first I had the error

spiderable: phantomjs failed: null

Then, I added the following environment variable in the modulus panel:

METEOR_PKG_SPIDERABLE_PHANTOMJS_ARGS = --ssl-protocol=tlsv1 --ignore-ssl-errors=yes --debug=true

This is still not working and the debug is outputting multiple times (like it's looping over an error) the following message in the modulus console:

2014-12-03T17:01:00 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () {
if (typeof Meteor === 'undefined'
    || Meteor.status === undefined
    || !Meteor.status().connected) {
  return false;
}
if (typeof Package === 'undefined'
    || Package.spiderable === undefined
    || Package.spiderable.Spiderable === undefined
    || !Package.spiderable.Spiderable._initialSubscriptionsStarted) {
  return false;
}
Tracker.flush();
return DDP._allSubscriptionsReady();
})(); })()" 
2014-12-03T17:01:00 [DEBUG] WebPage - evaluateJavaScript result QVariant(bool, false) 

If anyone knows how to solve this or succeeded to deploy a meteor project on modulus.io with SSL and spiderable. Let's me know the good way to do it :)

Thank a lot !

like image 368
Jean-Noël Avatar asked Dec 03 '14 17:12

Jean-Noël


1 Answers

I solved my problem as follows:

  1. I installed phantomjs locally and run the test script available at http://www.meteorpedia.com/read/spiderable/

    phantomjs phantomtest.js

This gave me more details about the error: Parse Error. Then, it was a javascript file that once compiled/minified, rendered an error caused by select2. The js library that was using it was flat-ui.js (http://designmodo.github.io/Flat-UI/).

I discover this by testing many deploys on *.meteor.com and by adding/removing .js file.

  1. I edit the flat-ui.js library to avoid Parsing Error.

  2. I redeployed on both modulus.io and *.meteor.com. All was working fine on *.meteor.com but still didn't work on modulus.io. That let me thinking about an SSL error but I only saw "spiderable: phantomjs failed: null" in the modulus.io logs.

  3. I add the following environment variable in the modulus panel:

    METEOR_PKG_SPIDERABLE_PHANTOMJS_ARGS = --debug=true

and it appears that it was a "SSL Handshake error":

[DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" )
  1. I add another option to the METEOR_PKG_SPIDERABLE_PHANTOMJS_ARGS environment variable:

    METEOR_PKG_SPIDERABLE_PHANTOMJS_ARGS = --ignore-ssl-errors=yes --debug=true

Now everything is working fine on modulus.io.

To sumup:

  • solve javascript errors
  • add METEOR_PKG_SPIDERABLE_PHANTOMJS_ARGS = --ignore-ssl-errors=yes

I hope this will help some dudes,

like image 79
Jean-Noël Avatar answered Oct 23 '22 13:10

Jean-Noël