[Solved] syntaxError async function main(event, context, callback) {

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.

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)

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: [
emr.terminateJobFlows(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response

Problem resolved, there was errors in babel.

Hi there - I’m seeing a similar problem, do you mind explaining what errors you saw in babel and how you resolved them?

My .babelrc file was missing so when i did a serverless deploy it did not transform my syntax.