[aws-lambda-nodejs] Recent changes in the module broke our setup (monorepo, private repos, typescript, lerna)
See original GitHub issueReproduction Steps
So it could be misconfiguration on our end, but recent changes most probably the ones in https://github.com/aws/aws-cdk/issues/8837 broke our setup and I could not find a running configuration for now.
so we have a monorepo with lerna, yarn workspaces, only typescript and the following structure
bin -> some scripts
infra-cdk/
bin/
lib/
lambdas/
function.ts
function2.ts
stack....ts
stack2..ts
packages/
package1/
src/
sth.ts
other.ts
package2/
node_modules/
lerna.json
package.json
yarn.lock
So we have only one node_modules and yarn.lock and generally the code before the changes used to find the node_modules which was there in the root of the project, our code has always set the projectRoot to the root of the project and in this way all has worked.
We didn’t have package.json in the lambdas directory, which somehow does not work now - so I’ve created one. Now I have a code state with changes which partially work if I
$ yarn install
$ yarn build:fresh (which makes clean and builds the packages)
$ yarn workspace infra-cdk cdk diff DevelopmentStack
This results in some of the lambdas have been built and probably the second one (using our private package) is broken with the message, which is in Error Log Section. Parcel tries to find our package, but It is not there. I should mention, that there are some other problems, which correlate with this issue - after this error the node_modules is missing some modules as for example lerna and I need to make yarn install again in order to work with repo. So my assumption is that the code uses now erroneously the lambda package.json but installs in the root directory, which leads to this problem.
Error Log
Bundling...
✨ Built in 25.48s
../../../../asset-output/index.js 2.4 KB 837ms
yarn install v1.22.4
[1/4] Resolving packages...
info If you think this is a bug, please open a bug report with the information provided in "/asset-output/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
stderr: warning package.json: No license field
warning Skipping preferred cache folder "/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-501".
warning No license field
error An unexpected error occurred: "https://registry.yarnpkg.com/@infra%2faws-utils: Not found".
Environment
- CLI Version :1.51.0
- Framework Version:1.51.0
- Node.js Version:v12.16.3
- OS :MacoOS Catalina 10.15.5
- Language (Version):TypeScript (3.9.6)
Other
If this is simply a configuration issue I’ll be glad to test some ideas or advices on how to handle this, or if you need more information please tell me.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (9 by maintainers)
Top GitHub Comments
Sorry, for all the tests I have used an in-tree package, where I just copied the files. Which I did also for your change, but I now see, that I forgot to exchange the imports - as I’m changing between different branches the whole day … I’ll retest ASAP and report here.
Ok, so it worked and it is a little bit faster on first run
the second run is around 5:30 minutes