middyjs / middy

🛵 The stylish Node.js middleware engine for AWS Lambda 🛵

Home Page:https://middy.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Create Node.js handler that imports @middy/core
  2. Initialize middy middleware with middy()
  3. Build and run application
  4. 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.

Thank you will! The deprecation of the CommonJs was the problem.