chalice
chalice copied to clipboard
chalice local stuck 'Restarting local dev server'
Every time I run chalice local, it gets stuck restarting local dev server. Usually it starts serving ~1 minute or so, sometimes it never ends until I do Ctrl +C. Very rarely it restarts in seconds.
I'm running it on Windows 10 through Anaconda prompt
Is there any solution for that?
Are you modifying of your app.py or other files in the meantime? It will restart the dev server whenever it detects you've made changes to your app.py. If you don't want that behavior, you can use the --no-autoreload option.
No, I'm not modifying anything meantime, just waiting for it to restart server to check if the changes work.
Ah so the issue is that it takes a while for the server to restart? Do you have any module level initialization in your app.py? How long does it take to just import your app?
$ time python -c "import app"
real 0m0.091s
user 0m0.054s
sys 0m0.029s
I had a bit of a similar problem with the SQS entrypoint, it seems to always restart at least once. I will investigate.
@jamesls Yes, it keeps printing Restarting local dev server for many times. All I have is importing some custom functions from chalicelib, POST request route and 2 global variables.
How long does it take to just import your app?
As I'm using windows, running Measure-Command {python -c "import app"} gives:
TotalMilliseconds : 678.3171
@Sytten are you also on windows? I've been trying to repro on my mac, perhaps it's something specific to windows.
No I am also on mac, the server seems to only restart once in my case and only for sqs triggers.
I have the same behavior on Chalice version 1.28 I wanted to call function, but it restarts server every 5 sec and in the logs it writes
2023-05-24 19:04:17.043 | INFO | app:
:298 - STAGE: Stage.LOCAL Serving on http://127.0.0.1:8000 Restarting local dev server. Credentials found in config file: ~/.aws/config 2023-05-24 19:04:23.247 | INFO | app: :298 - STAGE: Stage.LOCAL Serving on http://127.0.0.1:8000 Restarting local dev server. Credentials found in config file: ~/.aws/config
Maybe there are ideas how to make it not restart the server? I will be very grateful to you!