question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws-lambda-nodejs] Recent changes in the module broke our setup (monorepo, private repos, typescript, lerna)

See original GitHub issue

Reproduction 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:closed
  • Created 3 years ago
  • Comments:23 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
gergancommented, Jul 14, 2020

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.

0reactions
gergancommented, Jul 14, 2020

Ok, so it worked and it is a little bit faster on first run

yarn workspace infra-cdk cdk diff DevelopmentStack  19.11s user 3.19s system 3% cpu 9:40.68 total

the second run is around 5:30 minutes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring TypeScript for multiple packages in a Lerna + ...
A mono-repo is a single repository which contains a collection of packages ... mono-repo jump to step 5 to see how to set-up...
Read more >
Setting up a monorepo with Lerna for a TypeScript project
You know the benefits of keeping your codebase simple to maintain. Learn how to setup a monorepo with Lerna and configure it for...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
In this part, I will explain step by step how to setup Lerna, Yarn Workspaces and Typescript in a mono repo. In the...
Read more >
Managing Your Typescript Monorepo With Lerna and Codefresh
Lerna is a tool to manage Monorepos with Git and npm, which automatically ties together all package versions used across your repository. Assume ......
Read more >
A monorepo setup with lerna | Janniks Blog
A demonstration of a react + typescript monorepo setup with lerna. ... git repository, an empty packages folder for our apps and modules...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found