Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'aws-lambda' with pnp #621

Open
saveman71 opened this issue Jan 10, 2023 · 0 comments
Open

Cannot find module 'aws-lambda' with pnp #621

saveman71 opened this issue Jan 10, 2023 · 0 comments

Comments

@saveman71
Copy link

saveman71 commented Jan 10, 2023

I have the following error when running tsc -b:

../../.yarn/cache/@vendia-serverless-express-npm-4.10.1-f73485d9b7-083c393170.zip/node_modules/@vendia/serverless-express/src/configure.d.ts:2:25 - error TS2307: Cannot find module 'aws-lambda' or its corresponding type declarations.

It seems like adding @types/aws-lambda to peer dependencies should be enough to fix. Currently it's only in devDeps https://github.com/vendia/serverless-express/blob/0909ec4ffd09d9fd22538257b721b7d076d03732/package.json#L79

I'm still figuring out how exactly pnp works so this might not be relevant. For now I'm fixing it with the packageExtensions field in .yarnrc.yml:

packageExtensions:
  "@vendia/serverless-express@*":
    peerDependencies:
      "@types/aws-lambda": "*"
    peerDependenciesMeta:
      "@types/aws-lambda":
        optional: true

It seems like pnp is quite strict about how it finds required deps and if they're not listed in the package.json they're just not found. Feel free to close if not relevant, at least future users of this package + pnp will know the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant