Error: No "exports" main defined in /path/to/the/repo/node_modules/@middy/core/package.json
bornster opened this issue · comments
bornster commented
After updating middy/core and its connected packages (ex. middy/http-content-negotiation,middy/http-cors) from 4.x.x to 5.x.x encountered a new error during endpoint testing of Lambda handlers. Most likely an issue coming from the removal of support for CommonJS. For the lambda deployment I am using serverless.
const getListHandler = async (event, context) => {
return {
statusCode: 200,
body: "Hello World"
};
};
export const getList = middy(getListHandler)
.use(cors())
.use(httpSecurityHeaders());
Error: No "exports" main defined in /path/to/the/repo/node_modules/@middy/core/package.json
tsconfig.json
{
"extends": "./tsconfig.paths.json",
"display": "Node 18 + ESM + Strictest",
"compilerOptions": {
"lib": ["es2020"],
"target": "esnext",
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"checkJs": true,
"declaration": true,
"esModuleInterop": true,
"exactOptionalPropertyTypes": false,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"noEmitOnError": false,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "build",
"pretty": true,
"removeComments": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true
},
"ts-node": {
"require": ["tsconfig-paths/register"]
}
}
- Node.js: [18.12.0]
- Middy: [5.3.2]
- Serverless [3.38.0]
will Farrell commented
Is this dup of #1208 ?