Adding files to bundle.copyFiles doesn’t do anythi...
# help
d
Adding files to bundle.copyFiles doesn’t do anything. Could this be a bug?
Copy code
const func = new sst.Function(
      this,
      'func',
      {
        bundle: {
          copyFiles: [
            {
              from: 'node_modules/mymodule/myfile.ext',
              to: '.',
            },
          ],
        },
        handler: 'src/..'
      });
If I remove/add the bundle part I keep getting:
Stacks: Building changes...
Stacks: Synthesizing changes...
Stacks: No changes to deploy.
I would expect those files to be copied to the .sst/artifacts/…/function/ folder
t
This doesn't happen with SST start
Only on deploy
d
But then those functions won’t work on start right?
t
they should because they're still running locally and have access to the file system
they get spawned in your root folder (this probably needs to be updated to spawn in srcPath)
d
If we have this structure: • /src/myfunc/main.ts • /src/myfunc/data.json My main.ts is expecting ‘./data.json’ to be relative file. If I do the copyFiles, this will work with deploy, but won’t work with sst start
t
Yeah I'd suggest for now passing the path in dynamically if app.local is true
We need to fix this
I want to find a consistent way to do it without actually copying the file
I do this in a few places and it's a bit annoying that local isn't the same as prod
d
My example is just a very dumb version of what is happening. In our case, we use a node_module (draco3dgltf) that somehow is expecting encode and decoder scripts to be relative. Those are not working somewhat. I’m not super proud of the copyFile here. Just figured I should let you know this happens.