If this is a case of using Lambda in a completely wrong way, please let me know.
I want to set Scrapy to a Lambda function and call the function to start the crawl. My first problem is how to install it so that all paths are correct. I installed the program using a directory that will be archived as its root, so zip contains all the source files and the executable. I base my efforts on this article. On the line mentioned at the beginning of my function, where does the "process" variable come from? I tried,
var process = require('child_process'); var exec = process.exec; process.env['PATH'] = process.env['PATH'] + ':' + process.env['LAMBDA_TASK_ROOT']
but I get an error
"errorMessage": "Cannot read property 'PATH' of undefined", "errorType": "TypeError",
Do I need to include all the library files or only the executable from / usr / lib? How to include this line of code in the article I need?
Edit: I tried moving the code to child_process.exec and got an error
"errorMessage": "Command failed: /bin/sh: process.env[PATH]: command not found\n/bin/sh: scrapy: command not found\n"
Here is my current whole function
console.log("STARTING"); var process = require('child_process'); var exec = process.exec; exports.handler = function(event, context) {
source share