blackboard / lambda-selenium

Use Selenium Webdriver and Chrome inside AWS Lambda
MIT License
230 stars 51 forks source link

Cannot run gradle deploy #32

Closed willingham closed 6 years ago

willingham commented 6 years ago

I'm following your instructions in the java tutorial, and I keep getting an error when I run the deploy command about deprecated gradle features. Is there a specific version of gradle I should be running?

Here is a stacktrace:

paperclip:~/hl/incubator/blackboard-automated-test/lambda-selenium/lambda-selenium-java$ gradle clean unzipLibs shadowJar deploy --stacktrace
> Task :deploy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':deploy'.
> A problem occurred starting process 'command 'sls''

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':deploy'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:596)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'sls''
        at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:226)
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:349)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85)
        at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
        ... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'sls'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67)
        ... 4 more
Caused by: java.io.IOException: Cannot run program "sls" (in directory "/Users/thomas/hl/incubator/blackboard-automated-test/lambda-selenium/lambda-selenium-java"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
        ... 7 more

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 17s
7 actionable tasks: 6 executed, 1 up-to-date
wesmcouch commented 6 years ago

Try installing the serverless framework, I believe I left this out of the README, I am opening a PR to add this step in. npm install -g serverless

wesmcouch commented 6 years ago

Updated the README to reflect that change. https://github.com/blackboard/lambda-selenium/blob/master/docs/java-tutorial.md

willingham commented 6 years ago

Thanks for the info. That definitely helped. I've got it deployed, but when I try to run it, I'm just getting the following AWS region error.

com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
    at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:371)
    at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:337)
    at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
    at com.amazonaws.services.lambda.AWSLambdaClientBuilder.defaultClient(AWSLambdaClientBuilder.java:44)
    at com.blackboard.testing.lambda.TestInvoker.run(TestInvoker.java:16)
    at com.blackboard.testing.tests.ExampleTestSuite.runTest(ExampleTestSuite.java:33)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:844)

I've specified the region (us-east-1) in the serverless.yml and as an environment variable. Any suggestions?

wesmcouch commented 6 years ago

That sounds like you might need to set the region in your AWS credentials, check out this page under 'Setting the AWS Region'

willingham commented 6 years ago

Right, I'm just using environment variables for this, and it doesn't seem to pickup the AWS_DEFAULT_REGION variable

wesmcouch commented 6 years ago

I think AWS_REGION is the right one image

willingham commented 6 years ago

@wesmcouch Thanks for all your help! This is a really neat project, and I hope to be able to use it.

I did run into multiple issues while setting this up. In case this can help someone else, here are some of the issues/solutions:

For using AWS credentials that are not part of a profile:

(If you're using an AWS Role based login with or without MFA, you'll need to use the aws sts assume-role command to generate temporary credentials.)

Also, I received an error about the version of java that the software was compiled with. The solution for me was to install java8 and set the JAVA_HOME directory to java8.

pshiwakoti commented 6 years ago

I am running into the same issue which Willingham ran into which is BUILD FAILED in 19s 7 actionable tasks: 6 executed, 1 up-to-date when I ran gradle clean unzipLibs shadowJar deploy I looked on the discussion which suggests issuing command npm install -g serverless This command seems to work fine and Im issuing it before I issue gradle ... deploy command. But why Im still getting build failure? I followed instructions on your wiki page but Im stuck. Any suggestions will be appreciated.

wesmcouch commented 6 years ago

Can you run the command with --stacktrace and give the output of the exception?

pshiwakoti commented 6 years ago

C:\Users\pshiwakoti\Desktop\lambda-selenium-master\lambda-selenium-java>npm install -g serverless C:\Users\pshiwakoti\AppData\Roaming\npm\sls -> C:\Users\pshiwakoti\AppData\Roaming\npm\node_modules\serverless\bin\serverless C:\Users\pshiwakoti\AppData\Roaming\npm\slss -> C:\Users\pshiwakoti\AppData\Roaming\npm\node_modules\serverless\bin\serverless C:\Users\pshiwakoti\AppData\Roaming\npm\serverless -> C:\Users\pshiwakoti\AppData\Roaming\npm\node_modules\serverless\bin\serverless

serverless@1.27.3 postinstall C:\Users\pshiwakoti\AppData\Roaming\npm\node_modules\serverless node ./scripts/postinstall.js

C:\Users\pshiwakoti\Desktop\lambda-selenium-master\lambda-selenium-java>gradle clean unzipLibs shadowJar deploy --stacktrace

Task :deploy FAILED

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. See https://docs.gradle.org/4.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s 7 actionable tasks: 6 executed, 1 up-to-date

willingham commented 6 years ago

The sls command is installed with serverless. Can you verify that you can run the serverless/sls command in your current directory?

pshiwakoti commented 6 years ago

C:\Users\pshiwakoti\Desktop\lambda-selenium-master\lambda-selenium-java>serverless/sls

Serverless Error ---------------------------------------

Serverless command "/sls" not found. Did you mean "logs"? Run "serverless help" for a list of all available commands.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information ----------------------------- OS: win32 Node Version: 8.11.2 Serverless Version: 1.27.3

wesmcouch commented 6 years ago

I can't verify this works on windows, but it sounds like sls might not be hooked up to your $PATH environment variable. I would add C:\Users\pshiwakoti\AppData\Roaming\npm\ to your $PATH variable, and verify sls --version command works. Once this is complete I think it should work. This has never been tested on windows, and it is assuming a unix environment when specifying directories.

willingham commented 6 years ago

The command is serverless orsls, not both. Sorry for the confusion.

pshiwakoti commented 6 years ago

Sls is set up. C:\Users\pshiwakoti>sls --version 1.27.3 After I rerun the above serverless and gradle deploy commands I'm getting same build failure

serverless command works fine.

wesmcouch commented 6 years ago

I just put some steps together that will work with docker on Windows. First install docker.. You will need to modify this script and replace the AWS access key and secret with your own, included are examples. First run this to get to the command line of the docker container docker run -i -t jimador/docker-jdk-8-maven-node /bin/bash Next run the following lines, replacing the accesskeys with your own.

git clone https://github.com/blackboard/lambda-selenium.git
cd /lambda-selenium/lambda-selenium-java
npm install serverless -g
wget https://services.gradle.org/distributions/gradle-3.4.1-bin.zip
mkdir /opt/gradle
unzip -d /opt/gradle gradle-3.4.1-bin.zip
export PATH=$PATH:/opt/gradle/gradle-3.4.1/bin
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
export PATH=~/.local/bin:$PATH
pip install awscli --upgrade --user
mkdir ~/.aws
touch ~/.aws/credentials
touch ~/.aws/config
echo "[default]" >> ~/.aws/credentials
echo "aws_access_key_id=AKIAIOSFODNN7EXAMPLE" >> ~/.aws/credentials
echo "aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" >> ~/.aws/credentials
echo "[default]" >> ~/.aws/config
echo "region=us-east-1" >> ~/.aws/config
echo "output=json" >> ~/.aws/config
gradle clean unzipLibs shadowJar deploy

Edit: You will want to create a shared volume so that you can view the results (screenshots etc) in your normal desktop environment. To do that checkout https://docs.docker.com/storage/volumes/

pshiwakoti commented 6 years ago

Thank you for the guide. But here is the stacktrace Im getting after following your steps: I think it is missing serverless environment and I reran with the npm .. serverless command. My sls command works. It looks like I have to give security token but I don't know where because I have MFA set up.

root@7a45574385f8:/lambda-selenium/lambda-selenium-java# gradle clean unzipLibs shadowJar deploy --stacktrace :clean :unzipLibs UP-TO-DATE :compileJava :processResources :classes :compileTestJava :processTestResources NO-SOURCE :testClasses :shadowJar :deploy Serverless: Packaging service...

Serverless Error ---------------------------------------

ServerlessError: The security token included in the request is invalid.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information ----------------------------- OS: linux Node Version: 8.6.0 Serverless Version: 1.27.3

:deploy FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 36.589 secs

pshiwakoti commented 6 years ago

FYI I have provided my valid unexpired credentials like aws_access_key_id and aws_secret_access_key. I am using Multi Factor Authentication. So I'm not sure how to set that token up.

wesmcouch commented 6 years ago

Maybe try running aws configure to setup the credentials

pshiwakoti commented 6 years ago

I did that this morning. Credentials are good for 12 hours. So I tried echo "aws_session_token = XXX" >> ~/.aws/credentials where XXX is the token. Then did gradle .. deploy. No luck yet

pshiwakoti commented 6 years ago

After I copied my credentials from windows's .aws folder to Docker's Unix folder I was able to able to deploy and test it. Thank you.

pshiwakoti commented 6 years ago

hi Wesmcouch, I am having the following test failure. I tried to see stacktrace and info, here is what I get.

root@87c00d8bacfa:/lambda-selenium/lambda-selenium-java# gradle clean test --info Initialized native services in: /root/.gradle/native Connected to daemon DaemonInfo{pid=148, address=[9c3614ab-3d0b-422c-a001-c5f483100159 port:36653, addresses:[/127.0.0.1]], state=Idle, lastBusy=1528729033215, context=DefaultDaemonContext[uid=5da9cf11-d9ca-4989-9525-1a185ee7b1db,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/root/.gradle/daemon,pid=148,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=3642deb3-72bb-46ab-ac9a-7b37041640be.1, currentDir=/lambda-selenium/lambda-selenium-java}. Received result org.gradle.launcher.daemon.protocol.BuildStarted@2b175c00 from daemon DaemonInfo{pid=148, address=[9c3614ab-3d0b-422c-a001-c5f483100159 port:36653, addresses:[/127.0.0.1]], state=Idle, lastBusy=1528729033215, context=DefaultDaemonContext[uid=5da9cf11-d9ca-4989-9525-1a185ee7b1db,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/root/.gradle/daemon,pid=148,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be starting). The client will now receive all logging from the daemon (pid: 148). The daemon log file: /root/.gradle/daemon/3.4.1/daemon-148.out.log Starting 13th build in daemon [uptime: 45 mins 52.615 secs, performance: 100%, no major garbage collections] Executing build with daemon context: DefaultDaemonContext[uid=5da9cf11-d9ca-4989-9525-1a185ee7b1db,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/root/.gradle/daemon,pid=148,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant] Creating new cache for plugin-use-metadata, path /root/.gradle/caches/3.4.1/plugin-resolution/plugin-use-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@56dc3195 Creating new cache for client-status, path /root/.gradle/caches/3.4.1/plugin-resolution/client-status.bin, access org.gradle.cache.internal.DefaultCacheAccess@56dc3195 Starting Build Settings evaluated using settings file '/lambda-selenium/lambda-selenium-java/settings.gradle'. Projects loaded. Root project using build file '/lambda-selenium/lambda-selenium-java/build.gradle'. Included projects: [root project 'lambda-selenium'] Evaluating root project 'lambda-selenium' using build file '/lambda-selenium/lambda-selenium-java/build.gradle'. Creating new cache for metadata-2.23/module-metadata, path /root/.gradle/caches/modules-2/metadata-2.23/module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@1b7021a Creating new cache for metadata-2.23/artifact-at-repository, path /root/.gradle/caches/modules-2/metadata-2.23/artifact-at-repository.bin, access org.gradle.cache.internal.DefaultCacheAccess@1b7021a Using 2 worker leases. All projects evaluated. Selected primary task 'clean' from project : Selected primary task 'test' from project : Creating new cache for fileHashes, path /lambda-selenium/lambda-selenium-java/.gradle/3.4.1/taskHistory/fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@586f2f12 Creating new cache for annotation-processors, path /lambda-selenium/lambda-selenium-java/.gradle/3.4.1/fileContent/annotation-processors.bin, access org.gradle.cache.internal.DefaultCacheAccess@44044863 Tasks to be executed: [task ':clean', task ':compileJava', task ':processResources', task ':classes', task ':compileTestJava', task ':processTestResources', task ':testClasses', task ':test'] Creating new cache for jvmClassSignatures, path /lambda-selenium/lambda-selenium-java/.gradle/3.4.1/taskHistory/jvmClassSignatures.bin, access org.gradle.cache.internal.DefaultCacheAccess@586f2f12 Creating new cache for fileSnapshots, path /lambda-selenium/lambda-selenium-java/.gradle/3.4.1/taskHistory/fileSnapshots.bin, access org.gradle.cache.internal.DefaultCacheAccess@586f2f12 Creating new cache for taskHistory, path /lambda-selenium/lambda-selenium-java/.gradle/3.4.1/taskHistory/taskHistory.bin, access org.gradle.cache.internal.DefaultCacheAccess@586f2f12 :clean (Thread[Daemon worker Thread 9,5,main]) started. :clean Putting task artifact state for task ':clean' into context took 0.0 secs. Executing task ':clean' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs. :clean (Thread[Daemon worker Thread 9,5,main]) completed. Took 0.096 secs. :compileJava (Thread[Daemon worker Thread 9,5,main]) started. :compileJava Putting task artifact state for task ':compileJava' into context took 0.001 secs. Task :compileJava class loader hash: ac08a4e08b0ff990510d13105b85ea38 Task :compileJava actions class loader hash: 1526b3b109d06b230b32697697c7e0ca Creating new cache for metadata-2.23/module-versions, path /root/.gradle/caches/modules-2/metadata-2.23/module-versions.bin, access org.gradle.cache.internal.DefaultCacheAccess@1b7021a Executing task ':compileJava' (up-to-date check took 0.36 secs) due to: Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/classes/main has changed. Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/classes/main/com has been removed. Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/classes/main/com/blackboard has been removed. All input files are considered out-of-date for incremental task ':compileJava'. Compiling with JDK Java compiler API. :compileJava (Thread[Daemon worker Thread 9,5,main]) completed. Took 0.732 secs. :processResources (Thread[Daemon worker Thread 9,5,main]) started. :processResources Putting task artifact state for task ':processResources' into context took 0.001 secs. Task :processResources class loader hash: ac08a4e08b0ff990510d13105b85ea38 Task :processResources actions class loader hash: 6555dac1e74b24ca44f0b730fe968693 Executing task ':processResources' (up-to-date check took 0.003 secs) due to: Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/resources/main has changed. Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/resources/main/lib has been removed. Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/resources/main/lib/libosmesa.so has been removed. :processResources (Thread[Daemon worker Thread 9,5,main]) completed. Took 1.974 secs. :classes (Thread[Daemon worker Thread 9,5,main]) started. :classes Skipping task ':classes' as it has no actions. :classes (Thread[Daemon worker Thread 9,5,main]) completed. Took 0.002 secs. :compileTestJava (Thread[Daemon worker Thread 9,5,main]) started. :compileTestJava Putting task artifact state for task ':compileTestJava' into context took 0.0 secs. Task :compileTestJava class loader hash: ac08a4e08b0ff990510d13105b85ea38 Task :compileTestJava actions class loader hash: 1526b3b109d06b230b32697697c7e0ca Executing task ':compileTestJava' (up-to-date check took 0.046 secs) due to: Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/classes/test has changed. Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/classes/test/com has been removed. Output property 'destinationDir' file /lambda-selenium/lambda-selenium-java/build/classes/test/com/blackboard has been removed. All input files are considered out-of-date for incremental task ':compileTestJava'. Compiling with JDK Java compiler API. :compileTestJava (Thread[Daemon worker Thread 9,5,main]) completed. Took 0.238 secs. :processTestResources (Thread[Daemon worker Thread 9,5,main]) started. :processTestResources Putting task artifact state for task ':processTestResources' into context took 0.0 secs. file or directory '/lambda-selenium/lambda-selenium-java/src/test/resources', not found Skipping task ':processTestResources' as it has no source files and no previous output files. :processTestResources NO-SOURCE :processTestResources (Thread[Daemon worker Thread 9,5,main]) completed. Took 0.003 secs. :testClasses (Thread[Daemon worker Thread 9,5,main]) started. :testClasses Skipping task ':testClasses' as it has no actions. :testClasses (Thread[Daemon worker Thread 9,5,main]) completed. Took 0.001 secs. :test (Thread[Daemon worker Thread 9,5,main]) started. :test Putting task artifact state for task ':test' into context took 0.0 secs. Task :test class loader hash: ac08a4e08b0ff990510d13105b85ea38 Task :test actions class loader hash: 1526b3b109d06b230b32697697c7e0ca Executing task ':test' (up-to-date check took 0.023 secs) due to: No history is available. Starting process 'Gradle Test Executor 1'. Working directory: /lambda-selenium/lambda-selenium-java Command: /usr/lib/jvm/java-8-oracle/bin/java -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -Dfile.encoding=US-ASCII -Duser.country=US -Duser.language=en -Duser.variant -ea -cp /root/.gradle/caches/3.4.1/workerMain/gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 1' Successfully started process 'Gradle Test Executor 1' Stopped 0 worker daemon(s). Initialized native services in: /root/.gradle/native Gradle Test Executor 1 started executing tests.

com.blackboard.testing.tests.ExampleTestSuite STANDARD_OUT

Running categories [interface org.junit.Test]

com.blackboard.testing.tests.ExampleTestSuite > runTest[com.blackboard.testing.tests.LambdaTest:blackboardTest] STANDARD_ERROR SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Gradle Test Executor 1 finished executing tests.

com.blackboard.testing.tests.ExampleTestSuite > runTest[com.blackboard.testing.tests.LambdaTest:blackboardTest] FAILED com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider@7adadec: Duplicate property values for [aws_access_key_id]., com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@41cb898c: The requested metadata is not found at http://169.254.169.254/latest/meta-data/iam/security-credentials/] at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.getCredentialsFromContext(AmazonHttpClient.java:1166) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.runBeforeRequestHandlers(AmazonHttpClient.java:762) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:724) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) at com.amazonaws.services.lambda.AWSLambdaClient.doInvoke(AWSLambdaClient.java:2355) at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:2331) at com.amazonaws.services.lambda.AWSLambdaClient.executeInvoke(AWSLambdaClient.java:1345) at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:1321) at com.amazonaws.services.lambda.invoke.LambdaInvokerFactory$LambdaInvocationHandler.invoke(LambdaInvokerFactory.java:215) at com.sun.proxy.$Proxy22.runTest(Unknown Source) at com.blackboard.testing.lambda.TestInvoker.run(TestInvoker.java:19) at com.blackboard.testing.tests.ExampleTestSuite.runTest(ExampleTestSuite.java:33)

com.blackboard.testing.tests.ExampleTestSuite > runTest[com.blackboard.testing.tests.LambdaTest:googleTest] FAILED com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider@7adadec: Duplicate property values for [aws_access_key_id]., com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@41cb898c: The requested metadata is not found at http://169.254.169.254/latest/meta-data/iam/security-credentials/] at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.getCredentialsFromContext(AmazonHttpClient.java:1166) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.runBeforeRequestHandlers(AmazonHttpClient.java:762) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:724) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) at com.amazonaws.services.lambda.AWSLambdaClient.doInvoke(AWSLambdaClient.java:2355) at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:2331) at com.amazonaws.services.lambda.AWSLambdaClient.executeInvoke(AWSLambdaClient.java:1345) at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:1321) at com.amazonaws.services.lambda.invoke.LambdaInvokerFactory$LambdaInvocationHandler.invoke(LambdaInvokerFactory.java:215) at com.sun.proxy.$Proxy22.runTest(Unknown Source) at com.blackboard.testing.lambda.TestInvoker.run(TestInvoker.java:19) at com.blackboard.testing.tests.ExampleTestSuite.runTest(ExampleTestSuite.java:33)

2 tests completed, 2 failed Finished generating test XML results (0.024 secs) into: /lambda-selenium/lambda-selenium-java/build/test-results/test Generating HTML test report... Finished generating test html results (0.037 secs) into: /lambda-selenium/lambda-selenium-java/build/reports/tests/test :test FAILED :test (Thread[Daemon worker Thread 9,5,main]) completed. Took 6.602 secs.

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 11.598 secs Stopped 0 worker daemon(s). Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':test'.] from daemon DaemonInfo{pid=148, address=[9c3614ab-3d0b-422c-a001-c5f483100159 port:36653, addresses:[/127.0.0.1]], state=Idle, lastBusy=1528729033215, context=DefaultDaemonContext[uid=5da9cf11-d9ca-4989-9525-1a185ee7b1db,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/root/.gradle/daemon,pid=148,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done). root@87c00d8bacfa:/lambda-selenium/lambda-selenium-java#

wesmcouch commented 6 years ago

Hey it looks like the credentials are still the issue, maybe try to fix it the same way you did before, that should probably fix it.

pshiwakoti commented 6 years ago

I was able to build it successfully. But its failing the test. One other thing I have encountered problem is using Docker. I was able to see the two screenshot files last week on my build folder generated by Selenium but I wasn't able to copy it to my Windows. If I wanna edit the repo and modify the code of my own use using Eclipse, how do I do that. Can I install Cygwin instead?

wesmcouch commented 6 years ago

com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider@7adadec: Duplicate property values for [aws_access_key_id].

pshiwakoti commented 6 years ago

How to avoid Docker? I am not able to open and view screenshot files generated. Is there a replacement for Docker? I tried Cygwin but wget and curl commands failed with Cygwin. Im not sure if I should migrate to Mac?

pshiwakoti commented 6 years ago

hi Wesmcouch, Can you please suggest me if migrating to Mac is a better option instead of using Docker? Since the results are not saveable from Docker, why did you suggest me to use Docker in previous thread?

wesmcouch commented 6 years ago

@pshiwakoti1, I specified this in my original post, you might not have seen the edit, it was done shortly after I commented.

Edit: You will want to create a shared volume so that you can view the results (screenshots etc) in your normal desktop environment. To do that checkout https://docs.docker.com/storage/volumes/

prakash-shiwakoti commented 6 years ago

hi Wesmcouch, I have been trying to come up with a Docker command that would copy my build results like screenshots folder to windows directory but I just haven't been able to do so. I asked around and nobody is expert on Docker. If you could please provide that command I would really appreciate it. I read the above documentation you provided but wasn't of very much help.

prakash-shiwakoti commented 6 years ago

It turns out on Windows Dos Shell, I could type: docker cp XXXXX:/folder to the files on docker that needs to be copied . Where XXXXX is docker container id. That did the magic. Thanks

BanjoFromCurlwaa commented 6 years ago

Hi, I deployed the app using the docker commands, but got the same test result 'driver not executable' for both tests. Did prakash-shiwakota end up able to execute the tests successfully? My reading of the error is that it was due to the chromedriver executable failing - that is that the chromedriver was not able to be used by webdriver, rather than the inability to save screenshots?

Caused by: java.lang.Throwable: The driver is not executable: /var/task/lib/chromedriver at com.google.common.base.Preconditions.checkState(Preconditions.java:534) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:140) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:329) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157) at com.blackboard.testing.driver.LambdaWebDriverFactory.createWebDriver(LambdaWebDriverFactory.java:36) at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.createDriver(WebDriverThreadLocalContainer.java:227) at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.getAndCheckWebDriver(WebDriverThreadLocalContainer.java:111) at com.codeborne.selenide.WebDriverRunner.getAndCheckWebDriver(WebDriverRunner.java:142) at com.codeborne.selenide.impl.Navigator.navigateToAbsoluteUrl(Navigator.java:69) at com.codeborne.selenide.impl.Navigator.open(Navigator.java:32) at com.codeborne.selenide.Selenide.open(Selenide.java:79) at com.codeborne.selenide.Selenide.open(Selenide.java:53) at com.blackboard.testing.tests.LambdaTest.blackboardTest(LambdaTest.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.blackboard.testing.lambda.LambdaTestHandler.handleRequest(LambdaTestHandler.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:259) at lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:178) at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888) at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:283) at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:64) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:94)

cmay116 commented 4 years ago

Hi, I don't think I should make a new issue for this, but I'm hoping someone can help me out. When I run the command gradle clean unzipLibs shadowJar deploy I get the following error messages:

Serverless: Warning the Serverless Dashboard doesn't support the following runtime: java8
Serverless: Packaging service...

  Error --------------------------------------------------

  Error: ENOENT: no such file or directory, open 'build/libs/lambda-selenium-all.jar'

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.9.0
     Framework Version:         1.54.0
     Plugin Version:            3.1.2
     SDK Version:               2.1.2
     Components Core Version:   1.1.1
     Components CLI Version:    1.2.3

> Task :deploy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':deploy'.
> Process 'command 'sls'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
7 actionable tasks: 6 executed, 1 up-to-date

The main thing concerning me is the line Serverless: Warning the Serverless Dashboard doesn't support the following runtime: java8.

I've only just set up AWS and serverless, so I'm not very familiar with either. Can someone shed some light on what the problem is here?

Thank you

Perhaps @wesmcouch

mrajendrac commented 4 years ago

In windows, you need to change the deploy task in 'Build.gradle' (it should be in /lambda-selenium\lambda-selenium-java\build.gradle

it should be

task deploy(type: Exec) { commandLine 'cmd', '/c', 'sls' , 'deploy'

}

Let me know if this does not work

Thanks and Regards, RajendraC