Skip to content

Cannot run container locally using Lambda Emulator on M1 #237

@tanjinP

Description

@tanjinP

Hello, I am having success with this container on Lambda, but when running/testing locally using the Lambda emulator, I get the chromedriver issue. I am running this in on a Mac M1:

In a single terminal I run the container

docker run --platform linux/amd64 -p 9000:8080 umihico/aws-lambda-selenium-python:latest main.handler

In the another terminal I curl to invoke it (as per testing Lambda via emulator):

curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

After some time, I usually get 1 of the 2 following errors:

This one is more consistent

[ERROR] WebDriverException: Message: disconnected: Unable to receive message from renderer
  (failed to check if window was closed: disconnected: not connected to DevTools)
  (Session info: chrome=123.0.6312.122)
Stacktrace:
#0 0x00400077a863 <unknown>
....

This one usually occurs the first time invoke the container after starting it

[ERROR] SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally
  (chrome not reachable)
  (The process started from chrome location /opt/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x00400077a863 <unknown>
...

This might be related to #235

I have set my Docker memory at max (16GB) and I do see the memory hover up to 8GB when running this in docker stats (this is a random snapshot when the "curl" in in progress before the exception/error is thrown:

CONTAINER ID   NAME           CPU %     MEM USAGE / LIMIT     MEM %     NET I/O           BLOCK I/O        PIDS
842d00592c18   nervous_cray   333.92%   8.133GiB / 15.61GiB   52.09%    29.5kB / 15.9kB   242MB / 2.79MB   79

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions