Explored numerous options to resolve the problem. here are some option I have tried
"type": "module" in package.jsonrm -rf .serverless/ .webpack/ node_modules package-loc.json npm install
serverless print.mjs in serverless.ymlBefore serverless.yml
functions:
myfunction:
handler: handler.main
After serverless.yml
functions:
myfunction:
handler: handler.mjs.main
That means Serverless Framework wasn't automatically detecting .mjs files