appium-androidaws-device-farm

AWS Device Farm testcases getting failed


While running a test cases on AWS Device farm for Samsung Galaxy Note 10,I am getting following error. P.S: This issue is not because of module.

Failed to start Appium server: uncaughtException: Cannot find module 'internal/util/types'
date=Fri Dec 11 2020 09:09:29 GMT+0000 (Coordinated Universal Time), pid=8265, uid=1001, gid=1001, cwd=/usr/local/avm/versions/1.4.16/node_modules/appium, execPath=/usr/bin/node, version=v10.14.0, argv=[/usr/bin/node, /usr/local/bin/appium, --pre-launch, --log-timestamp, --log-no-colors, --use-keystore, --app, /tmp/scratchHgV3fC.scratch/share-cDnEwS.scratch/app-lHmzCQ.apk, --udid, R58M78B6WRN, --address, 127.0.0.1, --port, 4723, --log-level, debug, --platform-name, Android, --tmp, /tmp/scratchHgV3fC.scratch/appium-CqtB4x, --device-name, R58M78B6WRN, --platform-version, 9, --app-pkg, com.audetemi.trackhelp, --app-activity, com.audetemi.trackhelp.ui.activities.SplashActivity, --chromedriver-executable, /opt/chromedriver/linux/65/chromedriver], rss=89526272, heapTotal=73527296, heapUsed=45065896, external=848015, loadavg=[0.4404296875, 0.4755859375, 0.431640625], uptime=6914, trace=[column=15, file=internal/modules/cjs/loader.js, function=Function.Module._resolveFilename, line=580, method=Module._resolveFilename, native=false, column=25, file=internal/modules/cjs/loader.js, function=Function.Module._load, line=506, method=Module._load, native=false, column=17, file=internal/modules/cjs/loader.js, function=Module.require, line=636, method=require, native=false, column=18, file=internal/modules/cjs/helpers.js, function=require, line=20, method=null, native=false, column=31, file=evalmachine.<anonymous>, function=null, line=44, method=null, native=false, column=1, file=/usr/local/avm/versions/1.4.16/node_modules/appium/node_modules/md5calculator/node_modules/unzip/node_modules/fstream/node_modules/graceful-fs/fs.js, function=, line=11, method=null, native=false, column=30, file=internal/modules/cjs/loader.js, function=Module._compile, line=688, method=_compile, native=false, column=10, 

Solution

  • Your test code is using Appium server version 1.4.16, and this older version is no longer supported by AWS Device Farm. The minimum required Appium version on AWS Device Farm is 1.9.1, and using the custom test environment mode feature, you can use much more recent versions like 1.16.0.

    To change your Appium version, standard mode users would change their version through the API's test parameter options (test -> parameters -> appium_version) in the ScheduleRun API (if using the CLI/SDK). Custom environment users would modify the beginning lines of the install phase of their test spec file (see https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html) to use a different version of appium node.

    When scheduling a run from the AWS Device Farm console, there will be test spec examples for changing your Appium version using avm. I recommend taking a look at that sample file for an idea of how to use / configure the custom test environment mode.

    If you are still having issues, you can typically get more specific help on the AWS Device Farm Forums or through the support email: aws-devicefarm-support@amazon.com