question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed: EPIPE write EPIPE frequently seen when SELENIUM_PROMISE_MANAGER: false

See original GitHub issue

Bug report

  • Node Version: 6.9.1
  • Protractor Version: 5.1.2
  • Angular Version: 4.0.0
  • Browser(s): Chrome Version 57.0.2987.133 (64-bit)
  • Operating System and Version OS X Version 10.10.5 (14F2315)
  • Your protractor configuration file
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js

/* Third-party */
let HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
let JUnitXmlReporter = require('jasmine-reporters').JUnitXmlReporter;
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;

/* Custom */
let setup = require('./e2e/setup/setup');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  SELENIUM_PROMISE_MANAGER: false,
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  useAllAngular2AppRoots: true,
  beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e'
    });
  },
  onPrepare: function() {
    jasmine.getEnv().addReporter(new SpecReporter());
    jasmine.getEnv().addReporter(new JUnitXmlReporter({
      consolidateAll: true,
      savePath: browser.params.output || 'protractor/log',
      filePrefix: 'protractor_output'
    }));
    jasmine.getEnv().addReporter(new HtmlScreenshotReporter({
      cleanDestination: true,
      dest: 'protractor/log',
      filename: 'index.html'
    }));
    setup();
  }
};
  • A relevant example test
import { browser } from 'protractor';

import { A2Page } from './app.po';
import { NavPartial } from './nav/nav.po';
import { SettingsPage } from './settings/settings.po';
import { Utils } from './utils';

let utils = new Utils();

describe('a2 root', function() {
  let page: A2Page = new A2Page();
  let navPartial: NavPartial = new NavPartial();
  let settingsPage: SettingsPage = new SettingsPage();

  it('should be able to navigate to', () => {
    return page.navigateTo();
  });

  it('should take user to Settings', () => {
    return settingsPage.getTitle().then(title => {
      return expect(title).toEqual('Title');
    }).then(() => {
      return settingsPage.getSubtitle();
    }).then(subtitle => {
      return expect(subtitle).toEqual('Subtitle');
    });
  });

  it('should have a Home menu', () => {
    return page.navigateTo().then(() => {
      return navPartial.isHomePresent();
    }).then(present => {
      return expect(present).toBeTruthy();
    });
  });

  it('should have an Info menu', () => {
    return page.navigateTo().then(() => {
      return navPartial.isInfoPresent();
    }).then(present => {
      return expect(present).toBeTruthy();
    });
  });
});
  • Output from running the test
$ npm run e2e -- --params.baseUrl 'https://myurl'

> a2@0.0.0 pree2e /Users/me/a2
> webdriver-manager update

[13:56:14] I/update - chromedriver: file exists /Users/me/a2/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.29.zip
[13:56:14] I/update - chromedriver: unzipping chromedriver_2.29.zip
[13:56:14] I/update - chromedriver: setting permissions to 0755 for /Users/me/a2/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.29
[13:56:14] I/update - chromedriver: chromedriver_2.29 up to date
[13:56:14] I/update - selenium standalone: file exists /Users/me/a2/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar
[13:56:14] I/update - selenium standalone: selenium-server-standalone-3.4.0.jar up to date
[13:56:14] I/update - geckodriver: file exists /Users/me/a2/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1.tar.gz
[13:56:14] I/update - geckodriver: unzipping geckodriver-v0.16.1.tar.gz
[13:56:14] I/update - geckodriver: setting permissions to 0755 for /Users/me/a2/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1
[13:56:14] I/update - geckodriver: geckodriver-v0.16.1 up to date

> a2@0.0.0 e2e /Users/me/a2
> $(npm bin)/protractor "--params.baseUrl" "https://myurl"

[13:56:16] I/launcher - Running 1 instances of WebDriver
[13:56:16] I/direct - Using ChromeDriver directly...
Spec started

  a2 root
    ✓ should be able to navigate to
    ✓ should take user to Settings
    ✓ should have a Home menu
    ✗ should have an Info menu
      - Failed: EPIPE write EPIPE

**************************************************
*                    Failures                    *
**************************************************

1) a2 root should have an Info menu
  - Failed: EPIPE write EPIPE

Executed 4 of 4 specs (1 FAILED) in 22 secs.
[13:56:41] I/launcher - 0 instance(s) of WebDriver still running
[13:56:41] I/launcher - chrome #01 failed 1 test(s)
[13:56:41] I/launcher - overall: 1 failed spec(s)
[13:56:41] E/launcher - Process exited with error code 1

npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/me/.nvm/versions/node/v6.9.1/bin/node" "/Users/me/.nvm/versions/node/v6.9.1/bin/npm" "run" "e2e" "--" "--params.baseUrl" "https://myurl"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! a2@0.0.0 e2e: `$(npm bin)/protractor "--params.baseUrl" "https://myurl"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the a2@0.0.0 e2e script '$(npm bin)/protractor "--params.baseUrl" "https://myurl"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the a2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     $(npm bin)/protractor "--params.baseUrl" "https://myurl"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs a2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls a2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/me/a2/npm-debug.log

Also excerpt from npm-debug.log:

18 verbose stack Exit status 1
18 verbose stack     at EventEmitter.<anonymous> (/Users/me/.nvm/versions/node/v6.9.1/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
18 verbose stack     at emitTwo (events.js:106:13)
18 verbose stack     at EventEmitter.emit (events.js:191:7)
18 verbose stack     at ChildProcess.<anonymous> (/Users/me/.nvm/versions/node/v6.9.1/lib/node_modules/npm/lib/utils/spawn.js:40:14)
18 verbose stack     at emitTwo (events.js:106:13)
18 verbose stack     at ChildProcess.emit (events.js:191:7)
18 verbose stack     at maybeClose (internal/child_process.js:877:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  • Steps to reproduce the bug
  1. Use approximately the Node and Angular versions mentioned, Chrome browser, possibly Mac OS X. (Not yet certain how specific issue is to that combination.)
  2. Set SELENIUM_PROMISE_MANAGER: false in config (disable control flow).
  3. Due to (2) above, use promises everywhere in your test suite.
  4. Have a suite that for each of several tests, gets a URL and clicks or checks element presence.
  5. Very quickly you will start hitting Failed: EPIPE write EPIPE errors unpredictably.

I’m not using await. I cannot identify any unhandled promises in the test code either (and I’m experienced with promises), although that has been suggested in some of the comments, so I have to allow for that possibility. Still, it’s surprising that node would crash on an unhandled promise, if that’s the case. So it seems there’s a node bug in here somewhere, in addition to whatever problem there may be in my test or protractor or webdriver, etc.

  • The URL you are running your tests against (if relevant)

Sorry, it’s not public.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:13
  • Comments:47 (7 by maintainers)

github_iconTop GitHub Comments

12reactions
devoto13commented, Jul 20, 2017

In our project EPIPE errors were appearing, because tests (in TypeScript) were incorrectly using awaits. And therefore unhandled Promise rejections were happening randomly and leading to these errors. Once I’ve fixed incorrect usages we don’t have these errors anymore on Node 8.

Try to check your tests carefully for incorrect usages of await (either missing or redundant) or just incorrect Promise chaining (for example when you forgot to return Promise from helper methods). In our case typical error was using:

browser.wait(await EC.invisibilityOf(fade)); // incorrect

instead of:

await browser.wait(EC.invisibilityOf(fade)); // correct

Maybe it will help somebody, who also has this issue.

10reactions
Xaz16commented, Jan 16, 2018

@renehamburger thank you. After add this one to onPrepare section of my protractor.conf.js:

let currentCommand = Promise.resolve();
// Serialise all webdriver commands to prevent EPIPE errors
const webdriverSchedule = browser.driver.schedule;
browser.driver.schedule = (command, description) => {
   currentCommand = currentCommand.then(() =>
      webdriverSchedule.call(browser.driver, command, description)
    );
    return currentCommand;
};

Error ‘Failed: EPIPE write EPIPE’ is gone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

what is a "write EPIPE" error? - Google Groups
Any ideas on what I'm doing wrong? EPIPE means that writing of (presumably) the HTTP request failed because the other end closed the...
Read more >
Error: write EPIPE - Stack Overflow
You will get this error in some Os. To fix this for any Os, just specify the phantomjs: var phantomjs = require('phantomjs'); var...
Read more >
Error: write EPIPE - Scripting - McNeel Forum
Hello again,. Does anybody else see this? Received invalid data, please try again. VS Code Listener stopped. Please run CodeListener again.
Read more >
RedwoodJS 22.1 and Prisma 12.1 Workaround for Intermittent
If you happen to see some graphql errors – or even an error and t… ... intermittent: write EPIPE + Cannot read property...
Read more >
write EPIPE error on generating html to pdf
Hi Team, I'm trying to generate html to pdf using html-pdf npm . Please check below code const invoicePath = path.resolve(path.join(__dirname,
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found