Coder Social home page Coder Social logo

Comments (2)

kalpaitch avatar kalpaitch commented on September 26, 2024 3

I'll address those two suggestions separately:

  1. a) Changing the directory structure is a far from ideal solution in our use case. b) Nor do I feel caching the dependencies should be related to the CodeUri, I'm referring to the .aws-sam/deps/ directory, which only contains npm dependencies, not the .aws-sam/build/ or /.aws-sam/cache directories. c) many of these lambdas are in the same directory, and with the CodeUri specified it's still building to different .aws-sam/deps/ directories, see the manifest hash and CodeUri below are all the same but the dependency folder is different:
Manifest file is changed (new hash: ea718884c53ee6b0028d7c088f8fefeb) or dependency folder (.aws-sam/deps/70501117-f47d-4d63-84e2-1ed000911263) is missing for (Lambda1Function)                                                                                     
Building codeuri: backend/api/src/handlers/subfolder1
Manifest file is changed (new hash: ea718884c53ee6b0028d7c088f8fefeb) or dependency folder (.aws-sam/deps/5af21d52-0418-420a-82bd-775da3082ff6) is missing for (Lambda2Function)                                                                           
Building codeuri: backend/api/src/handlers/subfolder1
Manifest file is changed (new hash: ea718884c53ee6b0028d7c088f8fefeb) or dependency folder (.aws-sam/deps/1c6738a0-e3f2-4f74-9c6e-f983a96cd008) is missing for (Lambda3Function)                                                                              
Building codeuri: backend/api/src/handlers/subfolder1
  1. We are using esbuild to bundle these functions which is a far better solution in this case than use a layer, so this isn't an option.

In short, I think there probably is still an issue here, either documentation related or build related.

from aws-sam-cli.

lucashuy avatar lucashuy commented on September 26, 2024

Hi, the build dependencies are cached based on the manifest file (the package.json file), and the value of the CodeUri for each of the functions. If you tried moving the handler files to the same directory (and updating the corresponding CodeUris in the template), you should see that the deps are shared. Alternatively, you can utilize a Lambda Layer to share common dependencies, instead of having a single package.json shared between Lambda Functions.

from aws-sam-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.