4
我從 下載了phantomjs二進制文件,在我的本地主機上測試正常。如何在AWS中使用phantomjs 2.0 Lambda
包和創建AWS lambda函數
exports.handler = function (event, context) {
var path = require("path");
var Process = require("child_process");
Process.exec(path.join(__dirname,"./bin/phantomjs")+" --version", function (err, data) {
if (err) {
console.log(err.message);
context.fail(err.stack);
} else {
context.succeed(data);
}
})
}
但是當測試拉姆達,總是有
{"errorMessage":"Error: Command failed: /bin/sh: /var/task/bin/phantomjs: Permission denied
at ChildProcess.exithandler (child_process.js:658:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Socket.<anonymous> (child_process.js:979:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:466:12)"}
任何人有任何想法? 謝謝
http://api.phantomjscloud.com/很酷,感謝JASONS –