ERR_PACKAGE_PATH_NOT_EXPORTED
Valvide opened this issue · comments
When importing and using @middy/core in my Node.js AWS Lambda application, I am running into the following error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in "<path>/node_modules/@middy/core/package.json"
This prevents being able to import and initialize middy properly.
Steps to Reproduce
- Create Node.js handler that imports @middy/core
- Initialize middy middleware with middy()
- Build and run application
- Notice error when middy is imported
Expected behaviour
I want the middy to work as I expected it to work on the doc like it did when I was using middy v4
- Node.js: 18
- Middy: 5.0
Additional context
Add any other context about the problem here.
Are you trying to use v5 with CommonJS?
https://middy.js.org/docs/upgrade/4-5/#why-we-deprecated-cjs
Thank you will! The deprecation of the CommonJs was the problem.