When using `ApolloAPI` I need to add a `copyFiles`...
# help
j
When using
ApolloAPI
I need to add a
copyFiles
prop to the bundle. This works when running
sst build
-- my files are correctly copied to the output directory. But when I run
sst start
, the
copyFiles
doesn't seem to be respected, and in fact clears out those files that were copied
Could I be missing a configuration somewhere?
t
copyFiles doesn't run during sst start
I typically copyFiles into the same path they are so it "just works" both locally and remote
Curious what you're copying for apollo api?
j
It's some prisma configuration files. Long story short, I've got a monorepo with individual graphql services stitching together into a federated gateway, and one of my services references a database using prisma
Rather than figure that out, I just pulled prisma up as a lib. Not the ideal solution for me long-term since I may have more services in the monorepo in the future that reference a different database (with different prisma files), but for now it's just the one, and it'll work
t
ah ok
Yeah so copyFiles doesn't run locally because it can potentially be a lot to do on every file change, typically a relative path from your project root will work because that's where your code is executed from locally
and as long as you copy the files with the same structure in prod it should all work
j
Yeah I think the issue was with running
sst start
from the project root, but prisma being located within a workspace in the monorepo. It was looking for prisma in the root-level directory, and I was attempting to
copyFiles
up there, which is why pulling prisma up to the top lib level worked. It'll probably be a while before I need to change that so it'll do for now