blackboard / lambda-selenium

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

Issues deploying to Lambda #45

Open CheeseNPort opened 5 years ago

CheeseNPort commented 5 years ago

As per the instructions, downloaded the NodeJs example zip file, uploaded to a lambda function and when it runs, it returns the page title no problem. If I extract it all in Windows, edit the index.js file and then zip it again and upload, I get an error. In fact I even get the error when I just re-package the same files in a new zip file in windows.

Error: spawn EACCES at _errnoException (util.js:1022:11) at ChildProcess.spawn (internal/child_process.js:323:11) at Object.exports.spawn (child_process.js:502:9) at exec (/var/task/node_modules/selenium-webdriver/io/exec.js:116:27) at resolveCommandLineFlags.then.args (/var/task/node_modules/selenium-webdriver/remote/index.js:219:25) at at process._tickDomainCallback (internal/process/next_tick.js:228:7) From: Task: WebDriver.createSession() at Function.createSession (/var/task/node_modules/selenium-webdriver/lib/webdriver.js:777:24) at Function.createSession (/var/task/node_modules/selenium-webdriver/chrome.js:719:29) at createDriver (/var/task/node_modules/selenium-webdriver/index.js:167:33) at Builder.build (/var/task/node_modules/selenium-webdriver/index.js:639:16) at exports.handler (/var/task/index.js:31:26)

cloudgate313 commented 5 years ago

Having the same issue on mac. What software was used to compress the demo zip file?

START RequestId: a4173e6e-15a7-464a-84eb-bd90070c0bc6 Version: $LATEST Unable to import module 'index': Error at require (internal/module.js:11:18) END RequestId: a4173e6e-15a7-464a-84eb-bd90070c0bc6 REPORT RequestId: a4173e6e-15a7-464a-84eb-bd90070c0bc6 Duration: 0.56 ms Billed Duration: 100 ms Memory Size: 3008 MB Max Memory Used: 22 MB

CheeseNPort commented 5 years ago

Actually ended up solving this with the help from AWS support.

So now my build file which runs on Linux looks like this...

$ chmod 644 $(find src/ -type f) $ chmod 755 $(find src/ -type d) $ chmod 777 $(find src/ -type f) $ chmod 777 $(find src/ -type d) $ cd src && zip -r lambda.zip .

Not sure the first 2 lines are relevant now but with all of these I know it works. You have to zip them on a Linux machine as far as I understand which was easy for me because I'm running this script on Azure DevOps pipelines.

cloudgate313 commented 5 years ago

Thank you so much, CheeseNPort. Will check this out now. Appreciate you getting back to me.

Evan

On Tue, Jan 15, 2019 at 11:17 AM CheeseNPort notifications@github.com wrote:

Actually ended up solving this with the help from AWS support.

So now my build file which runs on Linux looks like this...

$ chmod 644 $(find src/ -type f) $ chmod 755 $(find src/ -type d) $ chmod 777 $(find src/ -type f) $ chmod 777 $(find src/ -type d) $ cd src && zip -r lambda.zip .

Not sure the first 2 lines are relevant now but with all of these I know it works. You have to zip them on a Linux machine as far as I understand which was easy for me because I'm running this script on Azure DevOps pipelines.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/blackboard/lambda-selenium/issues/45#issuecomment-454451904, or mute the thread https://github.com/notifications/unsubscribe-auth/ACybOIW0vmWLx5nxdmeOPwyh0eykh7fAks5vDf8EgaJpZM4Z9cWF .

kumaravel001 commented 4 years ago

Iam having the exactly same issue in windows 10. Can anyone help me out with this

xai1983kbu commented 4 years ago

@kumaravel001 I managed to solve this issue by using Linux Subsystem (Ubuntu). I created a folder in Ubuntu then copied: node_modules, lib, and index.js from Windows to this folder. For copying I used commands: $cp -r /mnt/c/Users/username/.../node_modules . $cp -r /mnt/c/Users/username/.../lib . $cp /mnt/c/Users/username/.../index.js . I changed mode for folders and index.js file. https://en.wikipedia.org/wiki/Chmod $chmod -R a+r node_modules $chmod -R a+r lib $chmod -R a+x index.js then I zipped all into lambda.zip by command: $zip -r lambda.zip . then copied lambda.zip from Ubuntu to 'Windows' $cp lambda.zip /mnt/c/Users/username/.../ then uploaded lambda.zip to S3 bucket and use it in AWS lambda service.

I hope it will be helpful.

thank you @CheeseNPort! and thanks for all participants of that QA in StackOverflow https://stackoverflow.com/a/56501298/9783262