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.
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.