CodeGenieApp / CodeGenieApp/serverless-express

Cannot find module 'aws-lambda' with pnp

Open
#621 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.