IssueRaiser

watch Option for SAM Build command

### Describe your idea/feature/enhancement When using `sam build` to build functions that will later be invoked through `sam local [invoke|start-lambda|start-api]`, you need to run `sam build` before each invoke. The reason for this requirement is because the build command places artifacts (code + dependencies + updated template) into a build folder. The `sam local [invoke|start-lambda|start-api]` use these built templates (this has updated locations to the built function code) by default but there is no way to update the built code without running `sam build` again. ### Proposal For the initial implementation of `sam build`, the `--watch` option [was out of scope](https://github.com/awslabs/aws-sam-cli/blob/develop/designs/sam_build_cmd.md#out-of-scope). The proposal is to add support for this option to all customers to enable building when source code changes. An alternative could be to make the `sam local` suite of commands build the function during invoke. The main concern with this is the speed at which you can now invoke (other build enhancements might be a requirement for this, speed, incremental builds, etc). ### Workaround All of the `sam local` command allow 'reloading' of the function code. This means for a given template, if you update the contents of a functions Code/CodeUri, SAM CLI will mount this updated content. So the current option for making interactions easier is to have two terminal windows open, one that builds and one that you local invoke with.

Posted by jfuss on Jan 8, 2019, 2:42 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments

support (Software)

watch Option for SAM Build command

jfussJan 8, 2019, 2:42 PM

### Describe your idea/feature/enhancement When using `sam build` to build functions that will later be invoked through `sam local [invoke|start-lambda|start-api]`, you need to run `sam build` before each invoke. The reason for this requirement is because the build command places artifacts (code + dependencies + updated template) into a build folder. The `sam local [invoke|start-lambda|start-api]` use these built templates (this has updated locations to the built function code) by default but there is no way to update the built code without running `sam build` again. ### Proposal For the initial implementation of `sam build`, the `--watch` option [was out of scope](https://github.com/awslabs/aws-sam-cli/blob/develop/designs/sam_build_cmd.md#out-of-scope). The proposal is to add support for this option to all customers to enable building when source code changes. An alternative could be to make the `sam local` suite of commands build the function during invoke. The main concern with this is the speed at which you can now invoke (other build enhancements might be a requirement for this, speed, incremental builds, etc). ### Workaround All of the `sam local` command allow 'reloading' of the function code. This means for a given template, if you update the contents of a functions Code/CodeUri, SAM CLI will mount this updated content. So the current option for making interactions easier is to have two terminal windows open, one that builds and one that you local invoke with.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue