Howdy! I'm having some problems that copyFiles see...
# sst
p
Howdy! I'm having some problems that copyFiles seems to not be working with
sst start
, but works with
sst deploy
. I have tried both for a Function and an Api path. Anybody using this?
f
Hey @Pål Brattberg, yeah currently
copyFiles
does not get run on
sst start
.
I was imagining that the functions are able to reference the files locally when running inside
sst start
. So
copyFiles
only made sense to be run on deploy.
Can you share a bit about ur usecase?
p
Yeah, so this is for a tiny express app running on Lambda, just used for OAuth verification. I used to bundle the template file with sls, but now with sst I am using copyFiles. For deploy it works great and I know where my template will reside (just a folder below the root of the zip. However, when trying this locally with sst start, the template files are not alongside the function, so I'd need to hard-code knowledge of the source structure to find the template, and only do that while launched from sst start (no matter the stage), which is a smelly thing 🙂 Having copyFiles simply do a similar thing was my expectation. I understand it might not be as simple as copying the files to the new destination, relative to the function och endpoints since it may duplicate the copied files locally and make live-reload un-intuitive, but no matter if it's copied or linked, it would be nice to be able to work with local development of functions that rely on copyFiles @Frank Not a deal-breaker ofc, since there is a work-around kludge available
f
I see. Can you share the folder structure of where the template file is relative to the function code?
Currently with
copyFiles
, the files are copied over on esbuild. But for
sst start
case, it wouldn’t make sense to copy the files over every time the file is re-built (in live reload).
I’m not sure if we should do something special for
sst start
where the files are copied over only ONCE on start up. 🤔