TestProject Forum

Docker Agent cannot be initialized because of a specific Error

Thanks for point that out, some key press by mistake when pasting here, I guess. But I figured that issue was latest testproject image was not downloaded on docker, so I was able to resolve the issue(deleted the old image).

But, with this done testproject agent is now able to start, only issue it is not downloading Chrome and Firefox drivers. Also, it is not starting two agents containers simultaneously, if one container starts, other one shuts automatically. Below is my complete docker-compose.yml:

version: "3.8"
services:
  testproject-agent-1:
    image: testproject/agent:latest
    container_name: testproject-agent-1
    depends_on:
      - chrome
      - firefox
    environment:
      TP_API_KEY: "API key"
      JAVA_OPTS: "-Djdk.lang.Process.launchMechanism=vfork"
      TP_SDK_PORT: "8686"             # Agent will listen on port 8686 for SDK connections
      CHROME: "chrome:4444"           # Address for Agent to communicate with Chrome browser
      CHROME_EXT: "localhost:5555"    # Address for accessing the Chrome Selenium server
      FIREFOX: "firefox:4444"         # Address for Agent to communicate with Firefox browser
      FIREFOX_EXT: "localhost:5556"   # Address for accessing the Firefox Selenium server
    ports:
      - "8585:8585"
      - "8686:8686"                     # Expose port for SDK<->Agent communication
  testproject-agent-2:
    image: testproject/agent:latest
    container_name: testproject-agent-2
    depends_on:
      - chrome
      - firefox
    environment:
      TP_API_KEY: "API Key"
      JAVA_OPTS: "-Djdk.lang.Process.launchMechanism=vfork"
      TP_SDK_PORT: "8787"             # Agent will listen on port 8686 for SDK connections
      CHROME: "chrome:4444"           # Address for Agent to communicate with Chrome browser
      CHROME_EXT: "localhost:5555"    # Address for accessing the Chrome Selenium server
      FIREFOX: "firefox:4444"         # Address for Agent to communicate with Firefox browser
      FIREFOX_EXT: "localhost:5556"   # Address for accessing the Firefox Selenium server
    ports:
      - "8888:8585"
      - "8787:8686"                     # Expose port for SDK<->Agent communication
  chrome:
    image: selenium/standalone-chrome
    shm_size: '1gb'
    ports:
      - "5555:4444"                     # Expose Selenium on port 5555
  firefox:
    image: selenium/standalone-firefox
    shm_size: '1gb'
    ports:
      - "5556:4444"                     # Expose Selenium on port 5556

Also, find the below log from testproject-agent1 container:

Obtained execution configuration for Agent: cVN5Ilc-YEaBWT1xuNRrxg

2021-05-26 04:35:57.426 [INFO ] i.t.a.Program *** AGENT - START ***

2021-05-26 04:35:58.803 [INFO ] i.t.a.h TestProject Agent 2.3.2 (02caf0271) on Linux

2021-05-26 04:35:58.928 [INFO ] i.t.a.h Running under user agent (/home/agent) of type Unknown with Guest privileges

2021-05-26 04:35:58.930 [INFO ] i.t.a.h Running inside docker 94a7c8f36196

2021-05-26 04:35:58.957 [INFO ] i.t.a.h No X11 available - headless mode.

2021-05-26 04:35:58.965 [INFO ] i.t.a.s.IdentityManager No identity file was found - Agent is not registered

2021-05-26 04:35:58.973 [INFO ] i.t.a.h Working folder: /opt/testproject/agent

2021-05-26 04:35:58.974 [INFO ] i.t.a.h Data folder: /var/testproject/agent

2021-05-26 04:35:59.000 [INFO ] i.t.a.h Agent IP addresses:

2021-05-26 04:36:00.154 [INFO ] i.t.a.m.f.l No Android SDK found

2021-05-26 04:36:00.184 [INFO ] i.t.a.i.l Waiting a bit for IOS Wrapper to come up...

2021-05-26 04:36:10.717 [INFO ] i.t.a.m.c.a Running in docker - ADB version querying will be skipped.

2021-05-26 04:36:10.722 [INFO ] i.t.a.m.c.a Detected Java [13-ea]

2021-05-26 04:36:10.723 [INFO ] i.t.a.m.c.a Detected DotNet [2.2.8]

2021-05-26 04:36:10.791 [INFO ] i.t.a.m.c.b Searching for installed browsers...

2021-05-26 04:36:10.805 [INFO ] i.t.a.m.c.b Getting external browser version via http://chrome:4444/wd/hub

2021-05-26 04:36:20.588 [ERROR] i.t.a.m.c.b Failed to get external CHROME version via: http://chrome:4444/wd/hub

2021-05-26 04:36:20.600 [INFO ] i.t.a.m.c.b Getting external browser version via http://firefox:4444/wd/hub

2021-05-26 04:36:24.255 [ERROR] i.t.a.m.c.b Failed to get external FIREFOX version via: http://firefox:4444/wd/hub

2021-05-26 04:36:24.431 [INFO ] i.t.a.m.c.b Finished detecting installed browsers.

2021-05-26 04:36:24.439 [INFO ] i.t.a.m.c.a Running in docker - drivers detection will be skipped.

2021-05-26 04:36:24.702 [INFO ] i.t.a.m.b Starting gRPC Server on port localhost:34377

2021-05-26 04:36:25.407 [INFO ] i.t.a.m.O Runtime information saved

2021-05-26 04:36:25.410 [INFO ] i.t.a.h Agent initialization is complete.

2021-05-26 04:36:25.417 [INFO ] i.t.a.s.IdentityManager No identity file was found - Agent is not registered

2021-05-26 04:36:25.474 [INFO ] i.t.a.m.f.k Appium server executable not found, assuming mobile components are not installed.

2021-05-26 04:36:25.481 [ERROR] i.t.a.m.x [Alert Message] - Mobile recording session can not be started because Appium failed to start.

Your Antivirus or malware protection software might be blocking it, turn it off and try again.

If this problem persists, please contact TestProject support.

2021-05-26 04:36:25.484 [INFO ] i.t.a.w.b Starting Web Server...

2021-05-26 04:36:25.485 [INFO ] i.t.a.w.b Starting internal web server...

2021-05-26 04:36:25.575 [INFO ] i.t.a.m.K Checking Agent's connectivity with the outside world...

2021-05-26 04:36:27.798 [INFO ] i.t.a.m.K Connection established successfully.

2021-05-26 04:36:27.802 [INFO ] i.t.a.f.c.a.k Direct connection (no proxy) is possible.

2021-05-26 04:36:27.803 [INFO ] i.t.a.f.c.a.k External connectivity is possible, proceeding to Authentication...

2021-05-26 04:36:27.815 [INFO ] i.t.a.f.c.a.a Trying to load Agent remote identity...

2021-05-26 04:36:27.818 [INFO ] i.t.a.s.IdentityManager No identity file was found - Agent is not registered

2021-05-26 04:36:27.818 [INFO ] i.t.a.f.c.a.a Checking if configuration passed via environment variable is present...

2021-05-26 04:36:27.819 [INFO ] i.t.a.f.c.a.a Trying to register with configuration provided...

2021-05-26 04:36:27.820 [INFO ] i.t.a.f.c.a.a Registering agent with configuration

2021-05-26 04:36:28.007 [INFO ] i.t.a.b.b.h Connecting TestProject servers...

2021-05-26 04:36:28.008 [INFO ] i.t.a.m.K Checking Agent's connectivity with the outside world...

2021-05-26 04:36:28.437 [INFO ] i.t.a.m.K Connection established successfully.

2021-05-26 04:36:28.438 [INFO ] i.t.a.b.b.h Registering Agent...

2021-05-26 04:36:28.439 [INFO ] i.t.a.b.b.h Preparing to send registration request to host https://api.testproject.io/

2021-05-26 04:36:29.201 [INFO ] i.t.a.b.b.h Sending registration request to https://api.testproject.io/agents/registration/agents

2021-05-26 04:36:30.977 [INFO ] i.t.a.b.a.d POST https://api.testproject.io/agents/registration/agents - 200 (avrqBhP2): No Message

2021-05-26 04:36:30.984 [INFO ] i.t.a.b.b.h Registration request succeeded.

2021-05-26 04:36:31.276 [INFO ] i.t.a.m.L Registered successfully

2021-05-26 04:36:31.546 [INFO ] i.t.a.s.IdentityManager Agent identity has been saved

2021-05-26 04:36:31.634 [INFO ] i.t.a.f.c.a.a Agent is registered as [Agent_cVN5Ilc-YEaBWT1xuNRrxg] (cVN5Ilc-YEaBWT1xuNRrxg), proceeding to authentication...

2021-05-26 04:36:31.640 [INFO ] i.t.a.f.c.a.a Authenticating with TestProject...

2021-05-26 04:36:31.656 [INFO ] i.t.a.s.c Requesting authenticating token...

2021-05-26 04:36:32.445 [INFO ] i.t.a.s.c Authenticated successfully

2021-05-26 04:36:32.528 [INFO ] i.t.a.m.f.l No Android SDK found

2021-05-26 04:36:32.529 [INFO ] i.t.a.i.l Waiting a bit for IOS Wrapper to come up...

2021-05-26 04:36:33.854 [INFO ] i.t.a.w.b Web server started on http://localhost:8585

2021-05-26 04:36:42.559 [INFO ] i.t.a.f.c.a.h Starting Signal...

2021-05-26 04:36:42.640 [INFO ] i.t.a.b.b.c Reporting state: Idle

2021-05-26 04:36:44.645 [INFO ] i.t.a.b.c.a Signal connected, awaiting authentication result...

2021-05-26 04:36:44.658 [INFO ] i.t.a.b.c.a Sent empty Session ID

2021-05-26 04:36:46.329 [INFO ] i.t.a.b.c.a Signal authentication finished

2021-05-26 04:36:46.339 [INFO ] i.t.a.b.c.a Connection Session ID: u3NtYRxd1

2021-05-26 04:36:46.340 [INFO ] i.t.a.b.c.a Signal authorized

2021-05-26 04:36:46.941 [INFO ] i.t.a.b.a.d POST https://api.testproject.io/api/v1/agent/certificate - 200 (3wspcRLQ): No Message

2021-05-26 04:36:47.064 [INFO ] i.t.a.w.b Added SSL connector

2021-05-26 04:36:47.067 [INFO ] i.t.a.s.IdentityManager Requesting remote identity...

2021-05-26 04:36:47.311 [INFO ] i.t.a.b.a.d GET https://api.testproject.io/api/v1/agent - 200 (BSS5cgoU): No Message

2021-05-26 04:36:47.342 [WARN ] i.t.a.s.IdentityManager Latest version is unknown, Agent might be outdated

2021-05-26 04:36:47.346 [INFO ] i.t.a.s.IdentityManager Agent identity has been saved

2021-05-26 04:36:47.347 [INFO ] i.t.a.f.c.a.d Account plan: Free

2021-05-26 04:36:47.347 [INFO ] i.t.a.h Refreshing & reporting capabilities...

2021-05-26 04:36:47.405 [INFO ] i.t.a.m.c.a Running in docker - ADB version querying will be skipped.

2021-05-26 04:36:47.408 [INFO ] i.t.a.m.c.a Detected Java [13-ea]

2021-05-26 04:36:47.409 [INFO ] i.t.a.m.c.a Detected DotNet [2.2.8]

2021-05-26 04:36:47.409 [INFO ] i.t.a.m.c.a Running in docker - drivers detection will be skipped.

2021-05-26 04:36:48.127 [INFO ] i.t.a.b.a.d POST https://api.testproject.io/api/v1/agent/capabilities - 200 (HAIhDVHy): Capabilities were received

2021-05-26 04:36:48.129 [INFO ] i.t.a.m.f.l No Android SDK found

2021-05-26 04:36:48.130 [INFO ] i.t.a.i.l Waiting a bit for IOS Wrapper to come up...

2021-05-26 04:36:51.524 [INFO ] i.t.a.m.A Reported Agent state and got response - [Agent Version: null]

2021-05-26 04:36:58.151 [INFO ] i.t.a.b.b.c Retrieving list of provisioned iOS devices...

2021-05-26 04:36:58.488 [INFO ] i.t.a.b.a.d GET https://api.testproject.io/api/v1/devices/provisioned - 200 (8f6IWL9q): No Message

2021-05-26 04:36:58.495 [INFO ] i.t.a.b.b.c Reporting state: Idle

2021-05-26 04:36:58.713 [INFO ] i.t.a.m.A Reported Agent state and got response - [Agent Version: 2.3.2]

2021-05-26 04:36:58.730 [INFO ] i.t.a.m.d.p Report uploading manager started.


@shivam Hello,
Unfortunately there still no official selenium images supported M1.
This issue opened as a feature request in 2020.
The temporary but working solution is to use one of the community images.
Following is a working example for M1:

version: "3.1"
services:
  testproject-agent:
    image: testproject/agent:latest
    container_name: testprojet-agent
    depends_on:
      - chrome
      - firefox
    volumes:
      - $PWD/m1-agent:/var/testproject/agent
    environment:
      TP_API_KEY: "API key"
      JAVA_OPTS: "-Djdk.lang.Process.launchMechanism=vfork"
      TP_AGENT_ALIAS: "M1 Docker Agent"
      CHROME: "chrome:4444"
      FIREFOX: "firefox:4444"
  chrome:
    image: seleniarm/standalone-chromium@sha256:ea811e4d60b42919dcce9e2d0dca16d8af4c3fbb933efb2263c516a1b07d97ea
    shm_size: '2gb'
    ports:
     - "4444:4444"
  firefox:
    image: seleniarm/standalone-firefox@sha256:d5b8235f3302aa03fff003a30ead1e1a02d488f9680882a8b88f8383ca2ed508
    shm_size: '2gb'    

P.S The firefox and chrome images is Selenium 4. Officially we supporting Selenium 3 only.
Let me know if this works for You.