title: Aws Lambda Ruby Crawler selenium chrome driver: 'unknown error: unable to discover open window in chrome'
body: <p>I want to deploy my crawler to 'Aws Lambda Environment'. I was tested my code in lambda-ci (<a href="https://github.com/lambci/docker-lambda/tree/master/ruby2.5" rel="nofollow noreferrer">https://github.com/lambci/docker-lambda/tree/master/ruby2.5</a>). and the result is success.</p>
  
  <p>But when i try to deploy my code in aws lambda, but i received this error. 'unknown error: unable to discover open window in chrome'
  <a href="https://i.stack.imgur.com/HAkX0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HAkX0.png" alt="enter image description here"></a></p>
  
  <p>My Project structure is</p>
  
  <pre><code>  /project
      lambda_hanlder.rb
      vender/
  </code></pre>
  
  <p>and i uploaded headless-chrome, chromedriver on aws lambda layer.</p>
  
  <p><strong>headless-chrome version is v1.0.0-55</strong> (<a href="https://github.com/adieuadieu/serverless-chrome" rel="nofollow noreferrer">https://github.com/adieuadieu/serverless-chrome</a>)</p>
  
  <p><strong>chromedriver version is 2.4.2</strong> (<a href="https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip" rel="nofollow noreferrer">https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip</a>)</p>
  
  <p>and this is my ruby code setup</p>
  
  <pre><code>Selenium::WebDriver::Chrome::Service.driver_path = '/opt/bin/chromedriver'
      options = Selenium::WebDriver::Chrome::Options.new(args: ['--headless', '--no-sandbox', '--disable-dev-shm-usage',
                                                                '--disable-gpu', '--disable-gpu-sandbox'])
      options.binary = '/opt/bin/headless-chromium'
      options.add_argument('window-size=1920x1080')
      options.add_argument('"user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36"')
  </code></pre>
  
  <p>and my gem file is</p>
  
  <pre><code>GEM
    remote: https://rubygems.org/
    specs:
      archive-zip (0.12.0)
        io-like (~&gt; 0.3.0)
      childprocess (3.0.0)
      chromedriver-helper (2.1.1)
        archive-zip (~&gt; 0.10)
        nokogiri (~&gt; 1.8)
      ethon (0.12.0)
        ffi (&gt;= 1.3.0)
      ffi (1.12.2)
      io-like (0.3.1)
      logger (1.4.2)
      mini_portile2 (2.4.0)
      multi_json (1.14.1)
      nokogiri (1.10.8)
        mini_portile2 (~&gt; 2.4.0)
      rubyzip (2.2.0)
      selenium-webdriver (3.142.7)
        childprocess (&gt;= 0.5, &lt; 4.0)
        rubyzip (&gt;= 1.2.2)
      typhoeus (1.3.1)
        ethon (&gt;= 0.9.0)
  </code></pre>
  
  <p>I do not know what is the problem. Does that problem is (headless, chromedriver) version compatibility? But In the lambda-ci-ruby enviroment, i didn't receive those error.
  How can i solve this problem?</p>