blackboard/lambda-selenium

Issues deploying to Lambda

CheeseNPort opened this issue · 5 comments

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)

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

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.

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

@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