4

I've been stuck with this error "Caused by: java.lang.IllegalStateException: The driver is not executable: /var/task/chromedriver" When I deploy my jar project into aws lambda function. The project works fine on my local machine, but it seems like aws can't execute chromedriver for some reason. My chromedriver file is placed in the resources folder.

Following is my test config file:

@Configuration
public class TestConfig {

    private static final Logger l = LoggerFactory.getLogger(TestConfig.class);

    private String chromeDriver = org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS ? "chromedriver.exe" : "chromedriver" ;

    public WebDriver getDriver(){
        URL resource = getClass().getClassLoader().getResource(chromeDriver);
        String chromePath = null;
        try {
            chromePath = Paths.get(resource.toURI()).toString();
        } catch (URISyntaxException e) {
            l.info("cannot find chromedriver in resources");
        }
        System.setProperty("webdriver.chrome.driver", chromePath);
        return new ChromeDriver();
    }
}

I have both chromedriver and chromedriver.exe, and I've tried to chmod 777 the file, but have no success.

3
  • I don't think chmod would have any effect if you are doing it before creating the zip file -- there's not (afaik) a structure in a zip file to store permissions. Extract the zip file somewhere locally to check that. Maybe you could first mark the file executable using Java? Commented Aug 31, 2017 at 23:57
  • Was calling chmod inside the lambda function itself. I'm deploying as a standalone jar into lambda function, not using zip. I've also tried marking it with your link and with setPosixFilePermissions, but still getting that error. Commented Sep 1, 2017 at 0:07
  • One other thought: create a server from the base image that the Lambda environment is built on and verify that this runs as expected on such a machine. Commented Sep 1, 2017 at 9:26

1 Answer 1

1

Lambda has a limit of 300 seconds and memory limit of 1536MB.

It is a very bad approach for you to try and launch a chromedriver in your lambda function. What you should be doing is setting up a Selenium grid and then using RemoteWebDriver to launch a Chrome browser in remote machine

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.