segment-boneyard / nightmare

A high-level browser automation library.
https://open.segment.com
19.54k stars 1.08k forks source link

No error when Nightmare fails due to wrong Electron executable format (platform) #1086

Closed tad-lispy closed 6 years ago

tad-lispy commented 7 years ago

Steps to reproduce:

  1. Have some kind of virtualisation (VM, Docker for Mac, etc.) with shared project folder.

  2. Install nightmare in your host OS (say OS X):

    npm install nightmare
  3. Prepare following test script:

    "use strict";
    
    const Nightmare = require("nightmare");
    
    const browser = new Nightmare;
    
    console.log("Start");
    
    browser
      .goto("https://www.scrambled.com/")
      .title()
      .end(console.log)
      .catch(console.error);

    and save it arch.js.

  4. Run it:

    $ node arch.js 
    Start
    Scrambled - Smart content, delicious results - Food Film & Photography
  5. Now run it in your virtual machine with different platform (say Linux):

    $ xvfb-run node arch.js
    Start

Expected result:

I'd like to get some kind of error that I could handle.

I know what's wrong, but it's not very friendly, especially for colleagues who are not very experienced with Node.js. In local development it can happen quite often that you run dependency installation on your host instead of VM or the other way around. It can be confusing and time wasting.

casesandberg commented 7 years ago

Using DEBUG=* from the debugging section does tell you when there is a problem like this.

tad-lispy commented 7 years ago

I respectfully disagree with closing this one. Having a possibility to infer the reason of failure from logs doesn't satisfy the need for proper error handling (with try - catch etc.).

When it comes to logs, IMHO this kind of failure should be reported with default runtime configuration. I can't imagine a situation where it would be desirable for a program to silently crash. It definitely shouldn't be a default behaviour.

casesandberg commented 7 years ago

Ah, I agree, my bad

tad-lispy commented 7 years ago

Thank you.

Nightmare is a great tool. Important part of our monitoring is running on it and I really appreciate the hard work your are putting into it's development. Keep it up :-)

matthewmueller commented 6 years ago

We'll be tracking this one in #1233. Thanks for bringing it up!