0

I'm trying to run my test cases on Fargate using Chimp, which internally uses Webdriver.io / Selenium. They run just fine in my docker container when I'm running them on my EC2 instance, but as soon as I upload my container to ECS and try to execute the same test using Fargate, I get the following error:

Chimp version:  0.50.2
ChromeDriver version:  ChromeDriver 2.34.522913 (36222509aa6e819815938cbf2709b4849735537c)
Java version:  openjdk version "1.8.0_151", OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12), OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
Selenium version:  3.8.1
Selenium drivers version:  chrome: 2.34, ie: 2.50.0, firefox: 0.19.1
OS version:  Linux 4.9.62-21.56.amzn1.x86_64
Node version:  v6.11.5
Browser version:  chrome undefined
[33m
[chimp] Running...[39m
[chimp][helper] setupBrowserAndDDP had error
{ Error: unknown error: Chrome failed to start: exited abnormally
    at initBrowser (node_modules/chimp/dist/lib/chimp-helper.js:189:43)
    at Object.setupBrowserAndDDP (node_modules/chimp/dist/lib/chimp-helper.js:264:7)
    at node_modules/chimp/dist/lib/cucumberjs/hooks.js:22:24
    at node_modules/meteor-promise/fiber_pool.js:43:40
    (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)
    at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
    at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:313:39)
    at Request.self.callback (node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (node_modules/request/request.js:1163:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)
    at IncomingMessage.g (events.js:292:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:128:9)
  details: undefined,
  message: 'unknown error: Chrome failed to start: exited abnormally\n  (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)',
  type: 'RuntimeError',
  seleniumStack: 
   { type: 'UnknownError',
     message: 'An unknown server-side error occurred while processing the command.',
     orgStatusMessage: 'unknown error: Chrome failed to start: exited abnormally\n  (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)' } }
Error: unknown error: Chrome failed to start: exited abnormally
    at initBrowser (node_modules/chimp/dist/lib/chimp-helper.js:189:43)
    at Object.setupBrowserAndDDP (node_modules/chimp/dist/lib/chimp-helper.js:264:7)
    at node_modules/chimp/dist/lib/cucumberjs/hooks.js:22:24
    at node_modules/meteor-promise/fiber_pool.js:43:40
    (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)
    at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
    at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:313:39)
    at Request.self.callback (node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (node_modules/request/request.js:1163:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)
    at IncomingMessage.g (events.js:292:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:128:9)
Cucumber steps failed

I've tried adding the following lines to the start of my test script to make sure Chrome is there and responding:

echo Running chrome version:
google-chrome --version

And the result is:

Running chrome version:
Google Chrome 62.0.3202.75 

So Chrome is there and responding. Why won't it work in Fargate?

The following debug line from the Chimp debug info at the start looks like the biggest culprit:

Browser version:  chrome undefined

I have no idea why it can't find it. It reports the correct version when I'm running locally.

Ryan Shillington
  • 15,463
  • 10
  • 75
  • 85

2 Answers2

1

You might also try Xvfb for the framebuffer without Headless Chrome, in the event --headless mode doesn't work with your application (which seems to be a somewhat frequent event).

Greg Perry
  • 145
  • 9
  • Well, you were correct that `--headless` was a huge mistake. I ended up starting my process with: `xvfb-run --auto-servernum --server-args=\"-screen 0 1080x1080x24\" bash -c \"myTask.sh\"`. Replace `myTask.sh` with whatever you're trying to run. – Ryan Shillington Feb 07 '18 at 19:21
0

A long time later I learned that my docker container hadn't successfully finished all of it's operations before I was saving the image. When I fixed that, this problem went away. X11 runs fine in a Docker container / AWS Fargate.

Ryan Shillington
  • 15,463
  • 10
  • 75
  • 85
  • This ended up sucking for me because Chrome headless (actually Selenium / Webdriver.io under Chrome headless) doesn't easily support downloading files. – Ryan Shillington Feb 07 '18 at 19:23