https://serverless-stack.com/ logo
#help
Title
# help
j

Justas Stromilas

11/16/2021, 11:11 PM
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

thdxr

11/16/2021, 11:23 PM
I think right now layers aren't made available locally
You'd need to install fastapi locally
j

Justas Stromilas

11/17/2021, 12:26 AM
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

thdxr

11/17/2021, 12:46 AM
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
2 Views