dougmoscrop/serverless-http

missing ESM setup/doc/support

kimyu92 opened this issue · 0 comments

Since amazon supports esm in its runtime, the setup below doesn't seem to work and I couldn't find any documentation around it except writtin in commonjs

Error:
app.lambdaHandler is undefined or not exported","stack":["Runtime.HandlerNotFound: app.lambdaHandler is undefined or not exported

Snippet

import serverless from 'serverless-http';
import express from 'express';

const app = express();

app.use(/* register your middleware as normal */);

const serverLessHandler = serverless(app, {
  basePath: '/rest',
});

export async function handler(event, context) {
  const res = await serverLessHandler(event, context);

  return res;
}

Any insight would be greatly appreciated.