Multiple meanings of "hot-reload" - sometimes from "src" dir, sometimes from "build" dir #4776
Unanswered
pete-heirendt-vacasa
asked this question in
Questions
Replies: 1 comment
|
Also note that the example animation on this doc page is demonstrating the 1st meaning/behavior above (that you can edit your code and see it run without having to do a I also learned that this will probably not work if you have any dependencies in your requirements.txt (Python), since those dependencies will not exist in your source directory. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Description
The 1st meaning, when using Python or Node, many users interpret "hot-reload" to mean that if you edit your source code, then
sam local start-apiwill pick up that code change without you also having to do asam build(that is the common definition among these non-compiled languages).A 2nd meaning of "hot-reload" is that you do have to re-build after every code change, but you do not have to restart
sam local start-api. This meaning was explained in following issue:Causing some confusion is that in reality both definitions can be observed -- the behavior of
sam local start-apichanges depending on whether or not the ".aws-sam/build" directory exists (the docs do not yet make any mention of this though).sam local start-apiif you have never done asam build(or if you manually deleted the ".aws-sam/build" directory). Also note that output fromsam local start-apihas one line saying this:Mounting /XXXX/src as /var/task:ro,delegated inside runtime containersam build. At that pointsam local start-apichanges to only load from the ".aws-sam/build" directory. (There is a small indication to the user: as mentioned in below steps, there is one line output bysam local start-apithat mentionsMounting ... inside runtime container.) Also note that output fromsam local start-apihas one line saying this:Mounting /XXXX/.aws-sam/build/Function2a as /var/task:ro,delegated inside runtime containerSteps to reproduce
sam local start-apisam build. Also note that output fromsam local start-apihas one line saying this:Mounting /XXXX/src as /var/task:ro,delegated inside runtime containersam local start-apisam buildsam buildafter each code change. Also note that output fromsam local start-apihas one line saying this:Mounting /XXXX/.aws-sam/build/Function2a as /var/task:ro,delegated inside runtime containerObserved result
The change in behavior is very unexpected, since the documentation pages do not yet have any mention of this detail:
Expected result
Would be great to have some mention of these two behaviors in the above docs pages.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version: SAM CLI, version 0.41.0All reactions