https://serverless-stack.com/ logo
Join SlackCommunities
Powered by
# help
  • s

    Sam Hulick

    08/01/2021, 11:35 PM
    also.. with Serverless Framework, I had set up an esbuild plugin so it would dump all the source code & source maps to a specific folder, so I could use the Sentry CLI to upload those sources + maps upon code build/deploy. how would I go about doing this with SST?
    f
    • 2
    • 7
  • s

    Sam Hulick

    08/02/2021, 1:38 AM
    how do we set CORS on S3 buckets? I’ve had no luck figuring out how. (equivalent of Serverless Framework’s
    cors: true
    )
    g
    t
    • 3
    • 9
  • t

    Tomasz Michalak

    08/02/2021, 10:47 AM
    hi, do you have an example how to add a custom layer to lambdas (want to add a custom logging library and make it available in all lambdas as a layer)?
    t
    f
    • 3
    • 3
  • s

    Sam Hulick

    08/02/2021, 12:50 PM
    Our plan is to have a monorepo with a bunch of stacks in it. Stack A is considered the "core" services like auth, DB, buckets, etc. Stacks B, C, and D are other things that depend on the core, like API and other microservices. Is there some way to set up
    yarn start --stage devname
    so that it only spins up a specific stack for them to work on, and will properly reference Stack A in a totally different stage?
    t
    • 2
    • 17
  • s

    Sam Hulick

    08/02/2021, 3:53 PM
    is there any quick way to get prettier Lambda func names? other than defining
    functionName
    for every API route?
    t
    j
    f
    • 4
    • 15
  • k

    Kujtim Hoxha

    08/02/2021, 4:19 PM
    Does
    sst
    automatically do tree shaking or we would need to do something to enable that (TS functions)?
    s
    f
    +2
    • 5
    • 27
  • s

    Sam Hulick

    08/02/2021, 6:29 PM
    is this an ok pattern? (referencing cross-stack in CDK)
    Copy code
    export default function main(app: <http://sst.App|sst.App>): void {
      // Set default runtime for all functions
      app.setDefaultFunctionProps({
        runtime: 'nodejs14.x',
        tracing: Tracing.DISABLED,
      });
    
      const coreStack = new CoreStack(app, 'core');
      new ApiStack(app, 'api', { cognitoAuth: coreStack.auth });
    }
    within
    CoreStack
    constructor, I’m doing
    this.auth = auth
    (and auth is an instance of
    sst.Auth
    ) lemme know if there’s a better way
    t
    k
    j
    • 4
    • 10
  • s

    Sam Hulick

    08/02/2021, 8:28 PM
    what’s the proper way to update all these packages when there’s an update?
    Copy code
    "dependencies": {
        "@aws-cdk/aws-apigatewayv2-authorizers": "1.111.0",
        "@aws-cdk/aws-cognito": "1.111.0",
        "@aws-cdk/aws-lambda": "1.111.0",
        "@aws-cdk/core": "1.111.0",
        "@serverless-stack/cli": "0.36.0",
        "@serverless-stack/resources": "0.36.0"
      }
    I can’t just do
    yarn upgrade-interactive
    like I usually do, because
    yarn sst add-cdk
    still adds version 1.111.0 of the packages
    f
    a
    t
    • 4
    • 13
  • a

    Ashishkumar Pandey

    08/02/2021, 9:09 PM
    Hey @thdxr, since AWS X-Ray isn’t supported with for
    sst.Api
    yet could you add a guide on how to integrate epsagon with
    sst.StaticSite
    and
    sst.Api
    . Epsagon looks amazing, thanks for sharing that with us.
    t
    r
    • 3
    • 8
  • s

    Sam Hulick

    08/02/2021, 9:27 PM
    apparently this is invalid:
    Copy code
    const userPool = auth.node.defaultChild as cognito.CfnUserPool;
      
      userPool.lambdaConfig = {
        customEmailSender: {
          lambdaArn: props.cognitoEmailSender.functionArn,
        },
      };
    I get this error:
    TypeError: Cannot set property 'lambdaConfig' of undefined
    . any ideas how I’d set this? TypeScript did give the OK here.. but apparently
    defaultChild
    doesn’t exist in this case
    t
    • 2
    • 6
  • s

    Sam Hulick

    08/02/2021, 11:09 PM
    is there some way to set
    removalPolicy
    to
    DESTROY
    for all resources in a stack? one of the nice things about CloudFormation is the cleanup.. and setting
    RETAIN
    as default for many resources defeats that purpose
    f
    • 2
    • 9
  • a

    Ashishkumar Pandey

    08/03/2021, 5:27 PM
    I don’t know whether this has been discussed before or not but how would I attempt blue-green deployments using HTTP APIs? I need this to perform A/B testing as well as to experiment with multiple microservices that might use different third-party services to achieve the same outcome. For ex: I could have a media service that uses mongodb atlas and another similar service that uses dynamodb. They might be the same service in code but their deployment needs to be such that I can redirect incoming traffic to use separate stages (I am assuming they have to be separate stages at least). Do you think this is achievable using SST, AWS APIGateway and lambda functions or do I need to setup custom loadbalancing to achieve this. I have heard people were using ECS with ALB to achieve this. Any guidance would be really appreciated as this makes life a lot simpler for me and my team.
    t
    s
    • 3
    • 9
  • a

    Adrián Mouly

    08/04/2021, 10:05 AM
    Is anybody having this issue when running the Lambdas locally?
    Copy code
    SyntaxError: Cannot use import statement outside a module
    t
    f
    • 3
    • 37
  • b

    Bhuvaneshwaran Rajendran

    08/04/2021, 2:18 PM
    May I know why "AWS:ECR:Repository" resource is used for starting the SST application? Whereas the Serverless framework doesn't require this resource for deploying the lambda functions.
    f
    • 2
    • 4
  • s

    Sam Hulick

    08/04/2021, 8:31 PM
    if I wanted to follow the model where each dev has their own AWS account as part of our organization, how would I set up SST so that any resources they deploy use the SSL certificate in the primary account? (in other words, cross-account access)
    a
    f
    t
    • 4
    • 11
  • s

    Sam Hulick

    08/04/2021, 9:28 PM
    more of a general CloudFormation/CDK thing: CloudFront key pairs can’t be generated automatically, right? seems like you have to generate the RSA private/public keys manually and then add them to the root account.
    f
    a
    • 3
    • 25
  • a

    Aaron McCloud

    08/04/2021, 11:59 PM
    I've been running into an issue that's had me stumped: I've been addng new
    <UnauthenticatedRoute>
    's, but for them if I pass in a
    state
    when I navigate to them with
    react-router-dom
    's
    Link
    , the
    state
    is stripped out. I know I need to change something here:
    Copy code
    <Route {...rest}>
          {!isAuthenticated ? (
            children
          ) : (
            <Redirect to={redirect === "" || redirect === null ? "/" : redirect} />
          )}
        </Route>
    To pass the
    state
    in
    <Link to={{ to="./classes/:id", state: { stuff: 'cool' }}}>
    through. But, I haven't figured out how yet. I'll be cranking on it later this evening, but any thoughts/help would be appreciated. 🙏
    j
    t
    • 3
    • 12
  • s

    Sam Hulick

    08/05/2021, 3:41 AM
    here’s a dumb general question about CDK for those who are more experienced with it. how do you go about getting helpful details about properties? like this page: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cognito.CfnIdentityPoolProps.html none of these properties are explained at all. no clue what they do. where does one go to learn what they are in more detail?
    a
    f
    • 3
    • 8
  • s

    Sakar

    08/05/2021, 7:14 AM
    Hi, is it possible to call a function both from step function and rest API? Please provide a full real example of step functions in sst.
    t
    s
    • 3
    • 5
  • a

    Artem Pabacham

    08/05/2021, 7:45 AM
    Hi there. I want to find a better way to expose node_modules to the API. Currently, I create a layer with all node_modules that is used within my Lambdas. I am using a script for that before the deploy.
    function prepare_node_modules_lambda_layer() {
    echo "Cleaning up workspace ..."
    rm -rf lambda-layers-node_modules
    echo "Creating layer ..."
    mkdir -p lambda-layers-node_modules/nodejs/node_modules
    echo "Prepare server node_modules lambda layer ..."
    cp -r ../../node_modules/knex lambda-layers-node_modules/nodejs/node_modules
    ...
    then
    layers: [
    new lambda.LayerVersion(stack, 'NodeModulesLayer', {
    code: lambda.Code.fromAsset('./lambda-layers-node_modules'),
    }),
    ],
    The idea was taken from https://dev.to/eddeee888/how-to-deploy-prisma-in-aws-lambda-with-serverless-1m76 But ultimately I don't find it an elegant solution. Any ideas?
    s
    t
    • 3
    • 10
  • h

    Hubert

    08/05/2021, 10:03 AM
    Is there any guide on how to effectively use SST with Python? Everything I've seen around revolves around JS. Currently trying to move a Serverless Framework project into SST.
    t
    f
    • 3
    • 9
  • f

    Fazi

    08/05/2021, 10:23 AM
    Hey all, I am trying to install dependencies in the
    requirements.txt
    file for an example lambda function. However, I keep getting a module not found error for the dependencies I am trying to install (
    requests
    ) My
    MyStack.js
    file is as follows:
    Copy code
    import * as sst from "@serverless-stack/resources";
    
    export default class MyStack extends sst.Stack {
      constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
        super(scope, id, props);
    
        // Create a HTTP API
        const api = new sst.Api(this, "Api", {
          defaultFunctionProps: {
            srcPath: "src/example",
          },
          routes: {
            "GET /": "lambda.handler",
          }
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          "ApiEndpoint": api.url,
        });
      }
    }
    My
    lambda.py
    file:
    Copy code
    import requests
    
    
    def handler(event, context):
        return {
            "statusCode": 200,
            "body": "Hello, World! Your request was received at {}.".format(
                event["requestContext"]["time"]
            ),
        }
    My directory structure:
    t
    s
    • 3
    • 16
  • v

    Vishal Vijay

    08/05/2021, 1:16 PM
    Hi @here Can I use my local MongoDB for development with SST?
    a
    t
    • 3
    • 9
  • s

    Simon Reilly

    08/05/2021, 2:59 PM
    Would it be possible to allow modifying the authenticated role assumed by federated identities in the Auth construct? Currently it is
    readonly
    and set by a private method
    t
    • 2
    • 13
  • a

    Alex Tozzi

    08/05/2021, 8:20 PM
    Hello all, I'm fairly new to serverless (and node, aws, etc, in general). I may have just missed it, but is there some kind of document detailing serverless framework vs SST? My new organization heavily uses the former, and while looking at documentation/etc, it seems clear to me the latter is what is newer. I've seen the message on a few pages on the website that the documentation will soon be migrating to use SST, as well.
    f
    • 2
    • 5
  • s

    Sam Hulick

    08/06/2021, 2:34 AM
    going with a one-developer-per-AWS-account setup, is it possible to somehow have it so the various accounts could access certain SSM parameters in the primary account? like, if we have API keys or JWT secrets or things along those lines
    f
    t
    • 3
    • 12
  • f

    Fazi

    08/06/2021, 10:40 AM
    Hey all, I am migrating some code over from localstack. One issue I am having is is that the Lambda functions I have created in SST do not have the correct
    AWS_ACCESS_KEY_ID
    and
    AWS_SECRET_ACCESS_KEY
    . I ran
    aws configure
    in the command line and set both of these, however, when I print the environment in my lambda function, the values inside the value function seem to differ. If I try to explicitly pass the correct values into the lambda function environment, I get the following (expected) error:
    Resource handler returned message: "Lambda was unable to configure your environment variables because the environment variables you have provided contains reserved keys that are currently not supported for modification. Reserved keys used in this request: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
    Could someone explain how I could possibly pass the correct access key and id to my lambda function?
    a
    f
    • 3
    • 14
  • n

    Nathan Cazell

    08/06/2021, 2:21 PM
    Hello everyone 👋 I am currently leveraging SST to deploy a small rest api. I really like the workflow and the local dev aspect of SST. However, I have a few functions that are not for the API (custom resource handlers, functions triggered by other events, etc.) and I'm wondering if there is a way to disable or exclude them from the 'local dev' behavior (websocket stuff). I'd like to keep using the sst.Function construct for those functions because of the ease of build with esbuild...
    t
    • 2
    • 15
  • s

    Sam Hulick

    08/06/2021, 4:17 PM
    anyone know what’s up with intellisense in SST projects?
    environment
    doesn’t show up as a property, but it should be. this might be a VS Code bug, seems like
    f
    t
    • 3
    • 18
  • s

    Sam Hulick

    08/06/2021, 6:25 PM
    errors thrown in the stack code doesn’t seem to stop the build process.
    t
    • 2
    • 40
1...101112...83Latest