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

dest.end error crash during run exit on GitLab CI / Windows #2181

Closed
PCStefan opened this issue Jul 20, 2018 · 38 comments · Fixed by #5045
Closed

dest.end error crash during run exit on GitLab CI / Windows #2181

PCStefan opened this issue Jul 20, 2018 · 38 comments · Fixed by #5045
Labels
CI General issues involving running in a CI provider OS: windows type: bug

Comments

@PCStefan
Copy link

PCStefan commented Jul 20, 2018

Cypress >=v3.0.0 on GitLabCI

Current behavior:

Any version >= v3.0.0 of the Cypress is failing to run on the GitLab's CI. The following error is being thrown exactly before cypress is exiting:

====================================================================================================

(Run Finished)


Spec Tests Passing Failing Pending Skipped 
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ HomePage\Home_Page_Quick_Lookup.js 00:05 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! 00:05 1 1 - - - 

cypress:server:cypress about to exit with code 0 +159ms
_stream_readable.js:595
dest.end();
^

TypeError: dest.end is not a function
at Socket.onend (_stream_readable.js:595:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
ERROR: Job failed: exit status 1

Desired behavior:

We expect the cypress to return the (All Done) message as Cypress v2.1.0 does with no error.

Steps to reproduce:

I have an issue with running cypress on the GitLab’s CI provider. I want to confirm whether this is a configuration issue, an incompatibility issue or a cypress bug.

I have installed cypress using the yarn command yarn add cypress. This will install me the latest version of cypress, namely v3.0.2.

[path-to-root-of-solution]/cypress.json

{
  "projectId": "……",
  "baseUrl": "…. "
}

[path-to-root-of-solution]/cypress/integration/HomePage/Home_Page_Quick_Lookup.js

describe('Home Page Test - Find Button', function () {

  before(function() {
    // navigate to home page (baseUrl)
    cy.visit('')
    
  })

  it('Check the button is on the page', function () {
    cy.get('[data-test=button-test-base]').should('exist')
  })
})

[path-to-root-of-solution]/gitlab-ci.yml

# … set path… 

stages:
  - test

run_test_suite:
  stage: test
  script:
    - call yarn add cypress
    - npx cypress run 

# .. end of file …

When I start the cypress using the command npx cypress run

Versions

• Windows Server 2012 R2
• Node: 8.9.4
• npm: 5.6.0
• Gitlab CI Runner: 9.5.0

Comments

I have searched to see if there are other who experienced this issue, but it seems that no one have. (or at least they didn’t bother in reporting the issue and/or sharing their solution).
The https://github.com/cypress-io/cypress/issues/1841 is the only issue that is a bit relevant to this problem in the sense that the pipeline fails when cypress is about to exit.

We have tried to use other versions of cypress:
► v3.0.2, v3.0.1, v3.0.0 – the above error is being generated
► v2.1.0 – no error is being generated

@PCStefan PCStefan changed the title Cypress >=v3.0.0 failing to exit on GitLab CI Runner Cypress v3.0.2 failing to exit on GitLab CI Runner Jul 20, 2018
@PCStefan
Copy link
Author

Not working in v3.0.3 either

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Jul 31, 2018
@DGolverdingen
Copy link

I have exactly the same issue! I really would like a fix and start using this in my CI nightly build.

@dubcanada
Copy link

dubcanada commented Aug 13, 2018

Same issue here with buddy.works and my local machine (Mac).

@Lagahan
Copy link

Lagahan commented Aug 15, 2018

I have the same problem, runs fine from terminal on my laptop running Ubuntu but exits with that error while running from command prompt on a Windows Server 2016 Jenkins node.

@TetianaMalva
Copy link

I have the same issue.

_stream_readable.js:511
    dest.end();
         ^

TypeError: dest.end is not a function
    at Socket.onend (_stream_readable.js:511:10)
    at Socket.g (events.js:292:16)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

@ainglese
Copy link

ainglese commented Sep 17, 2018

We have the same issue too.

  • Windows Server 2012 R2
  • Node: 8.2.1
  • npm: 6.2.0
  • Gitlab CI Runner: 11.2.0

this is blocking for us. anyone managed to workaround this issue?

@ainglese
Copy link

any news or eta on this issue?

@jennifer-shehane
Copy link
Member

We have an example of the cypress-example-kitchensink running and passing within Gitlab CI, so it appears that runs on Gitlab CI do not all fail.

If someone can give a reproducible example - or isolate exactly what is different from their run and example - that will help us track down where the exit status is coming from.

Also, you can get more in depth run logs by setting DEBUG in the command line.

@PCStefan
Copy link
Author

PCStefan commented Nov 20, 2018

I have upgraded both my gitlab to version v11.4.2 and the cypress to version v3.1.2 and I am still getting the error.

The project is quite simple:

  1. I have downloaded one CMS from the internet, namely DNN Platform v8.2.0
  2. I have added a button to the homepage
  3. I have wrote a small cypress script to test if the button exists on the page.

i.e. the single fixture within the cypress

describe('Home Page Quick Lookup', function () {
  before(function() {
    cy.visit('')
  })

  beforeEach(function () {
    // Cypress normally clears out cookies between each test. This line keeps dnn's anti-forgery
    // validation token so that calls to the api still work between tests
    Cypress.Cookies.preserveOnce('__RequestVerificationToken')
  })

  it('Checks the elements are on the page', function () {
    cy.get('[data-test=quick-lookup-base]').should('exist')
  })

})
  1. I have run it locally with cypress and no error is being generated.
  2. I have added it the GitLab CI and it is failing. I have added the CI to run with the DEBUG flag.

i.e. [.gitlab-ci.yml]

- set DEBUG=cypress:*
- call yarn add cypress@3.1.2
- npx cypress run --record --key %CypressKey_Test% --config baseUrl=%TestDeploy_TargetUri%

I have attached the log file (~1030 lines). cypress-gitlab-ci--v312.log. However, I have replaced some of the content (urls, username, external apis) due to some contract limitations/liabilities. However, the lines 66 and 1017 from the debug are the same: cypress:server:cypress about to exit with code 0 . Why would cypress mention twice that is about to exit ?

@WillerWasTaken
Copy link

Hello there. Any update on this issue?

@lebull
Copy link

lebull commented Jan 22, 2019

Same thing here for 3.1.4. Behavior is reproduced on windows 10, but not mac.

@jennifer-shehane
Copy link
Member

The failure is being thrown from the readable-stream package on this line of code. This is included in core Node as stream

Our Node version:

  • 8.2.1

Your original comment seems to indicate this was introduced in version 3.0.0 of Cypress which was released on May 29, 2018.

This file had commits made to it May 21, 2018 - it is one of 3 files that require Node stream.

I suspect that this error was introduced in the commit above and only happens on Windows in GitLab.

I've seen some open issues concerning TTY in GitLab? That's a wild guess that it's related though.

@jennifer-shehane jennifer-shehane changed the title Cypress v3.0.2 failing to exit on GitLab CI Runner dest.end error crash during run exit on GitLab CI / Windows Jan 31, 2019
@lebull
Copy link

lebull commented Feb 4, 2019

I should note that this issue happens on my local machine. We are using TFS and not GitLab for our CI, but it's windows either way.

Messing around my setup some more, it turns out that we were using a grunt-exec task to execute our integration tests. When running cypress directly, we do not see this behavior. Switching this task out with grunt-shell is a successful workaround for us.

@JulianoGTZ
Copy link

i have same trouble.

@GabrielfLuchtenberg
Copy link

Same here

@rolandharrison
Copy link

Same with me. Been waiting for this to be fixed.

@renanperalta
Copy link

Same problem here... Fix please!

@rafaelcaviquioli
Copy link

Hello Jeniffer, I need you

@phdo-pedro
Copy link

Any update on this issue? I have the same issue too!

@jennifer-shehane
Copy link
Member

This issue seems to be related: #3863

Using git bash on windows with pre-commit causes this error but running cypress through git bash normally works which is odd

Can y'all confirm if you are using precommit hooks?

This also explains some possible fixes: typicode/husky#459 (comment)

@rafaelcaviquioli
Copy link

I don't use

@renanperalta
Copy link

@jennifer-shehane I tried what you suggested above, but with no result. Even using Node 8.16, the error happens.

@renanperalta
Copy link

@PCStefan Did you find any solution to the problem? I've tried other versions of Node ^ 8.0.0 and Cypress ^ 3.0.0, but it does not work, only Cypress version 2.1.0 works correctly with git runner in Windows.

@bahmutov
Copy link
Contributor

Might be related to d154739

@bahmutov bahmutov mentioned this issue Aug 27, 2019
5 tasks
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs investigating Someone from Cypress needs to look at this labels Aug 27, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Aug 27, 2019
@tejas-hosamani
Copy link

Hi, any update/fix on this issue?
I am using:

 "husky": {
      "version": "2.7.0",
}

"cypress": {
      "version": "3.4.1",
}

Facing the same exact issue.

@bahmutov
Copy link
Contributor

There is a pull request that fixes this issue but it hasn't been merged and released yet. You can also apply a patch yourself following https://docs.cypress.io/guides/guides/debugging.html#Patch-Cypress

@tejas-hosamani
Copy link

Awesome. Thank you so much! 😃

@nweiser1
Copy link

was this fixed yet in an official release?

@AliceShi789654
Copy link

Any update on this issue? I have the same issue too!

@jelsav
Copy link

jelsav commented Sep 17, 2019

@bahmutov Thanks for the patch! After applying it, we didn't encounter dest.end error while running Cypress E2E tests on GitLab's CI / Windows.

From the other side, after applying a patch, we faced with a new problem with duplicate log entries on test execution. Please see the screenshot of a Job below:

CIGitLab

Is there a way to avoid duplicate log entries?

Thanks.

@bahmutov
Copy link
Contributor

bahmutov commented Sep 17, 2019 via email

@tejas-hosamani
Copy link

tejas-hosamani commented Sep 17, 2019

Yup, I have used the patch and I can confirm this side-effect.

@nweiser1 @AliceShi789654 Try using the patch. It's not hard to do 🙂

@bahmutov
Copy link
Contributor

@jelsav did you apply the patch correctly - you need to remove existing pipe lines. I have tried the patch in https://circleci.com/gh/cypress-io/cypress-test-tiny/4442 and everything looks ok

Screen Shot 2019-09-19 at 10 27 54 AM

here is my patch file patches/cypress+3.4.1.patch

diff --git a/node_modules/cypress/lib/exec/spawn.js b/node_modules/cypress/lib/exec/spawn.js
index ed13727..7748f19 100644
--- a/node_modules/cypress/lib/exec/spawn.js
+++ b/node_modules/cypress/lib/exec/spawn.js
@@ -138,8 +138,15 @@ module.exports = {
         child.on('close', resolve);
         child.on('error', reject);
 
-        child.stdin && child.stdin.pipe(process.stdin);
-        child.stdout && child.stdout.pipe(process.stdout);
+        if (child.stdin) {
+          debug('piping process STDIN into child STDIN')
+          process.stdin.pipe(child.stdin)
+        }
+
+        if (child.stdout) {
+          debug('piping child STDOUT to process STDOUT')
+          child.stdout.pipe(process.stdout)
+        }
 
         // if this is defined then we are manually piping for linux
         // to filter out the garbage

@bahmutov bahmutov added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Sep 19, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 19, 2019

The code for this is done in cypress-io/cypress#5045, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@jelsav
Copy link

jelsav commented Sep 20, 2019

@bahmutov

A few days ago, we applied a patch that we downloaded from here: https://github.com/CodingGardenCommunity/app-frontend/blob/08dbf63b59631faef0a9945cf8b20b40b138f2fc/patches/cypress%2B3.4.1.patch

It fixed dest.end error but we found a new issue with duplicated log entries.

Today, we applied a patch file you provided in your last comment. We no longer have problems with dest.end error or duplicated log entries.

Cypress version: 3.4.1

Thank you very much!

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI General issues involving running in a CI provider OS: windows type: bug
Projects
None yet