Hi, I'm looking to adopt SST within our project bu...
# help
j
Hi, I'm looking to adopt SST within our project but I've ran into an issue when prototyping, apologies if this was asked before, I wasn't able to find an answer through search. I have an existing layer that's deployed with SLS containing common code which is used within other SLS services. I'm trying to transition one service to SST, but I've been unable to make imports work when developing (sst start), although it seems to work once deployed. Any clue what might be the issue ? @Frank
t
I think right now layers aren't made available locally
You'd need to install fastapi locally
j
So I created a poetry project where Api construct expects handlers to be, which points to the local dependency that I deploy as layer, this seems to pull it and it works in development, thanks.
As a general question, what's a preferable way to reuse common libraries between SST projects ? The way I have it set up with SLS, which I described in my question, can be sometimes cumbersome as I have to redeploy the layer frequently if I'm testing/developing something, which can take a while. Should I just abandon the layer for SST and simply point to it locally and let STS package it together separately for each service ?
t
What I do is conditionally create the layer if app.local === true. No need for the layer locally and just slows down build time
I think code sharing should primarily be done through NPM and bundled into the function. Layers don't speed anything up (unless you have a huge dependency and don't want builds to have to ship it n times)
Additionally our Prisma example conditionally creates a layer for nonlocal (Prisma is huge so this speeds up deploys) https://github.com/serverless-stack/serverless-stack/blob/master/examples/prisma/stacks/index.ts