Hi i am developing an app using AWS EMR, all tests work locally but when I serverless deploy to Lambda I get the following error.
Error:
async function main(event, context, callback) {
^^^^^^^^
SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
Code:
import { success, failure } from “./libs/response-lib”;
import * as emrLib from "./libs/emr-lib"
import AWS from “aws-sdk”;
AWS.config.update({ region: “eu-west-1” });
var emr = new AWS.EMR();
export async function main(event, context, callback) {
const data = JSON.parse(event.body);
const params = {
JobFlowIds: [
data.JobFlowIds
]
};
emr.terminateJobFlows(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
}