Hi folks, I've noticed that when using `sst start`...
# help
d
Hi folks, I've noticed that when using
sst start
with an api with multiple routes defined that the code will only rebuild if I change the handler file referenced in the route config, not if I change a file imported by the handler. ie. if I have config like this:
Copy code
const api = new sst.Api(this, 'Api', {
    routes: {
        'GET /route1': `route1.handler`,
        'GET /route2': `route2.handler`,
        'GET /route3': `route3.handler`,
        'GET /route4': `route4.handler`,
    }
});
and all of those handlers import a
config.ts
file or something, saving
config.ts
won't cause any of them to rebuild. Is this a known issue?
d
I have experienced this too, need to save the actual handler file before it will refresh. Haven’t gotten around to opening an issue for it though.
f
Oh hmm… @Dan Coates can you show me how you are importing
config.ts
?
d
They are just standard
import config from './config'
style imports, nothing fancy or dynamic. That said, I actually can't replicate this right at the moment though it was happening consistently yesterday. I'll keep an eye on it and let you know if I get a clearer idea of when/why it is happening...
f
Sounds good! I think it might know what the issue is. Was
config.ts
a newly added file?
Just opened an issue about this, see if this describe what u saw https://github.com/serverless-stack/serverless-stack/issues/1069
d
@Frank I just tested in my project and that’s exactly what’s happening. If you add a new file while
sst start
is running, it doesn’t get watched. Also explains why @Dan Coates’s project suddenly didn’t have the issue (because he would have restarted
sst start
)!
d
Thanks @Frank for creating the issue. It is quite possible that my problem was the same as @Dan Greaves, it was pretty early stages for the project so was creating and moving around files a lot.
f
Got it! Thanks for confirming guys!