cypress: 5.5.0 regression of 'We failed to record the video' error in Firefox when running 2 spec files

Regression of this fix https://github.com/cypress-io/cypress/issues/6408

Current behavior

We are running Cypress via Docker in our Gitlab CI/CD and it seems that the video recording issue is back with 5.5.0, reported here https://github.com/cypress-io/cypress/issues/6408 for Cypress 4.x. The specific image we are using is cypress/included:5.5.0@sha256:1bade581de1f7ea02b8a000f4526ded862e020adfd5f5b95cf58eb884cb344d3

Note this only affects Firefox, not Chrome.

Warning: We failed processing this video.
This error will not alter the exit code.
TimeoutError: operation timed out
    at afterTimeout (/root/.cache/Cypress/5.5.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (/root/.cache/Cypress/5.5.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Warning: We failed to record the video.
This error will not alter the exit code.
Error: ffmpeg exited with code 1: pipe:0: Function not implemented
    at ChildProcess.<anonymous> (/root/.cache/Cypress/5.5.0/Cypress/resources/app/packages/server/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:310:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
Error: ffmpeg exited with code 1: pipe:0: Function not implemented
    at ChildProcess.<anonymous> (/root/.cache/Cypress/5.5.0/Cypress/resources/app/packages/server/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:310:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
Error: ffmpeg exited with code 1: pipe:0: Function not implemented
    at ChildProcess.<anonymous> (/root/.cache/Cypress/5.5.0/Cypress/resources/app/packages/server/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:310:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

Desired behavior

  • Firefox video-recording should work.
  • Tests should run and pass, even if video-recording fails.

Test code to reproduce

Code from here, running on Cypress 5.5.0 replicates this: https://github.com/cypress-io/cypress/issues/6408

Versions

  • Cypress 5.5.0 cypress/included:5.5.0@sha256:1bade581de1f7ea02b8a000f4526ded862e020adfd5f5b95cf58eb884cb344d3
  • Gitlab 13.4.3-ee

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 11
  • Comments: 47 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Have the same problem with Chrome 89.

Found a quick temp fix is to add the below to the cypress config: "video": false

@laerteneto, @rubencodes, @ViniciusResende - It’s an unfortunate state of affairs, but video in Cypress is just plain broken in FF93+. Pranajv1001 has created https://github.com/cypress-io/cypress/issues/18415, and I’ve started looking into the problem over there.

I’m going to suggest we move conversation to that issue, just so we have one bug for tracking the problem. Closing this issue does not reflect a belief that this isn’t a real issue, or a lack of interest in fixing it! It is both real and important. Just trying to consolidate the conversation into one place.

Started to happen with Chrome 89, was working fine with Chrome 88

Error: ffmpeg exited with code 1: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Conversion failed!
    at ChildProcess.<anonymous> (/home/builder/.cache/Cypress/6.6.0/Cypress/resources/app/packages/server/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:315:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

So, this issue has become a bit of a catchall for ffmpeg errors in general, but there is at least one case that may have an explanation with a hint from https://github.com/cypress-io/cypress/issues/9128#issuecomment-795687329

Theory on some of these ffmpeg errors

Cypress trashes the video and screenshot folder by default before each run when run via cypress run. If tests are run in parallel in Cypress, where there are multiple calls of cypress run being run at the same time, the video folder will be deleted at the start of each call to cypress run. If another parallel run is trying to access the video folder after this directory has been deleted, this could cause the errors about " No such file or directory" or also possibly the compression errors like “compression errored”.

We haven’t verified this completely but this seems like a scenario that could happen.

Suggestion

Set the Cypress config property trashAssetsBeforeRuns to false. This will not delete the video, screenshots, and download folders whenever cypress run is called.

Please let us know if this resolved any of your issues and we can come up with a larger solution.

We are also seeing this problem pop up in our gitlab pipelines with 8.3.0.
Warning: We failed processing this video. This error will not alter the exit code. TimeoutError: operation timed out at afterTimeout (/root/.cache/Cypress/8.3.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:46:19) at Timeout.timeoutTimeout [as _onTimeout] (/root/.cache/Cypress/8.3.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)

We are using Electron 91 and only have videos set to save upon failure: videoUploadOnPasses=false

@jennifer-shehane This does not seem to fix the issue for me on Cypress 8.2.0 on GitHub actions with browser Firefox. The video processing still fails (and I am running them sequentially). The timeout would suggest that cypress gets killed before the video is finished processing.

UPDATE: What is interesting is that the videos are actually generated. I do store them as artifact and I can download them and although they seem to be missing some frames, they seem to be fine.

The full error text (after each test run) is:

Warning: We failed processing this video.

This error will not alter the exit code.

TimeoutError: operation timed out
    at afterTimeout (/github/home/.cache/Cypress/8.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (/github/home/.cache/Cypress/8.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)

@wrotson

http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_88.0.4324.182-1_amd64.deb

Also having the above^ issue. Running Cypress 9.2.1 in GitLab CI/CD, on Firefox, with the cypress/browsers:node16.5.0-chrome94-ff93 image, I get the output:

Warning: We failed processing this video.
273 This error will not alter the exit code.
274 TimeoutError: operation timed out
275    at afterTimeout (/<gitlab-path>/cache/Cypress/9.2.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:46:19)
276    at Timeout.timeoutTimeout [as _onTimeout] (/<gitlab-path>/cache/Cypress/9.2.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:76:13)
277    at listOnTimeout (node:internal/timers:557:17)
278    at processTimers (node:internal/timers:500:7)

I ran with DEBUG=cypress:server:video, and see the following output towards the start of my test run:

cypress:server:video capture started { command: "ffmpeg -n 20 /<gitlab-path>/cache/Cypress/9.2.1/Cypress/resources/app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -f webm -r 18 -i pipe:0 -y -vcodec libx264 -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' -preset ultrafast /<gitlab-path>/cypress/videos/login.spec.ts.mp4" } +1s
63  cypress:server:video capture stderr log { message: 'ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers' } +2ms
64  cypress:server:video capture stderr log { message: '  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516' } +1ms
65  cypress:server:video capture stderr log { message: '  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg' } +0ms
66  cypress:server:video capture stderr log { message: '  libavutil      56. 24.101 / 56. 24.101' } +0ms
67  cypress:server:video capture stderr log { message: '  libavcodec     58. 42.100 / 58. 42.100' } +0ms
68  cypress:server:video capture stderr log { message: '  libavformat    58. 24.100 / 58. 24.100' } +0ms
69  cypress:server:video capture stderr log { message: '  libavdevice    58.  6.101 / 58.  6.101' } +0ms
70  cypress:server:video capture stderr log { message: '  libavfilter     7. 46.101 /  7. 46.101' } +1ms
71  cypress:server:video capture stderr log { message: '  libswscale      5.  4.100 /  5.  4.100' } +0ms
72  cypress:server:video capture stderr log { message: '  libswresample   3.  4.100 /  3.  4.100' } +0ms
73  cypress:server:video capture stderr log { message: '  libpostproc    55.  4.100 / 55.  4.100' } +0ms

(No additional cypress:server:video output after that.)

I have video set to true and trashAssetsBeforeRuns set to false in my cypress.json file. I should note, I’m not running tests in parallel.

Potentially unrelated, but I see the following output at the start of my run as well:

[272:0113/225017.388353:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
53[272:0113/225017.389761:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
54[272:0113/225017.389784:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
55[443:0113/225017.426331:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 

I’m facing ffmpeg error with Cypress version : 7.5.0 . Do we have a fix were we can have parallel support + video recording ?? I had to disable video.

Below are the debug logs from cypress

cypress:server:video capture errored: { error: 'ffmpeg exited with code 1: /tmp/build/123/codebase/cypress/videos/test.spec.js.mp4: No such file or directory\n', stdout: '', stderr: 'ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers\n' + ' built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516\n' + ' configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg\n' + ' libavutil 56. 24.101 / 56. 24.101\n' + ' libavcodec 58. 42.100 / 58. 42.100\n' + ' libavformat 58. 24.100 / 58. 24.100\n' + ' libavdevice 58. 6.101 / 58. 6.101\n' + ' libavfilter 7. 46.101 / 7. 46.101\n' + ' libswscale 5. 4.100 / 5. 4.100\n' + ' libswresample 3. 4.100 / 3. 4.100\n' + ' libpostproc 55. 4.100 / 55. 4.100\n' + '[mjpeg @ 0x678c140] EOI missing, emulating\n' + "Input #0, image2pipe, from 'pipe:0':\n" + ' Duration: N/A, start: 1624006383.640000, bitrate: N/A\n' + ' Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc\n' + '/tmp/build/123/codebase/cypress/videos/test.spec.js.mp4: No such file or directory\n' }

this seems to have fixed it for me (still testing but 10 clean runs so far):

  • moving all the tests to one file instead of multiple spec files
  • this is how my cypress.json file looks like
"videoUploadOnPasses": false,
"video": true,
"videoCompression": false,

@jarretmoses adding "video" : false to your config file should fix it (not 100% sure since some people say it still happens with that). You’ll lose video recordings though

This might help someone. We used to face a similar issue with chrome and cypress 6.3.0. Then we came to know with the Cypress team’s support that this happens because we were running 3 parallel processes of cypress run on the same server using Jenkins. Next, we tried running a single process on the same server and purposely failing some of the tests, in that case, it worked perfectly fine(videos were recorded properly). The root cause was either the parallelization not being handled properly or high usage of the server resources. Though we are sceptical it’s the latter because all the time while running 3 processes, server resources were underutilized. Now we are trying to dockerize the cypress run.

[2021-01-14T07:54:36.098Z] Warning: We failed to record the video.
[2021-01-14T07:54:36.098Z] 
[2021-01-14T07:54:36.098Z] This error will not alter the exit code.
[2021-01-14T07:54:36.098Z] 
[2021-01-14T07:54:36.098Z] Error: ffmpeg exited with code 1: /var/lib/jenkins/workspace/xxxxxxxx-web-sonar-CBXDY/Automation_Tests/cypress/videos/UI/xxxxxx/xxxxxxxxx.desktop.spec.js.mp4: No such file or directory
[2021-01-14T07:54:36.098Z] 
[2021-01-14T07:54:36.098Z]     at ChildProcess.<anonymous> (/home/consul/.cache/Cypress/6.2.1/Cypress/resources/app/packages/server/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
[2021-01-14T07:54:36.098Z]     at ChildProcess.emit (events.js:315:20)
[2021-01-14T07:54:36.098Z]     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)