https://serverless-stack.com/ logo
Join Slack
Powered by
# sst
  • g

    Greg Martin

    10/27/2021, 2:43 PM
    I feel like our application has aspects that lend themselves to different databases. In some cases NoSQL (DynamoDB) seems like a perfect fit. In other cases (mainly transactional records), I feel like we would be better served with something like MySQL. In both cases, I would like for our API layer to utilize Redis as a caching mechanism to ease the load on the underlying database models. I am hoping (assuming) that something like this can be accomplished with SST. Thoughts?
    t
    • 2
    • 4
  • s

    Seth Geoghegan

    10/27/2021, 3:08 PM
    If anyone needs to build an API on top of resources within an existing VPC (e.g. an RDS DB that is not serverless), this is how I did it with SST
    • 1
    • 1
  • m

    Muhammad Ali

    10/27/2021, 7:02 PM
    I have question specific to sst stack w.r.t typescript (first time coding in typescript so yea) I am trying to create helper methods which can create api-stacks for me. The idea is that i will pass in
    <http://sst.App|sst.App>, name, props
    and rest would be generic. I am planning to use
    props
    to pass in which methods to create (
    get
    ,
    post
    etc) since the name would be same and then use
    props.tables
    to attach permissions to specific tables (dynamodb). Right now my props interface looksl ike this
    Copy code
    interface MyApiProps extends sst.StackProps {
      readonly authorizer: apigAuthorizers.HttpUserPoolAuthorizer;
      readonly table?: sst.Table;
      readonly get: boolean;
    }
    The problem i am having is on
    table?
    property. given that its "optional" it can exist or not. Now when i try to make a custom prop by this code
    Copy code
    new MyApiStack(app, "heartbeat", {authType: sst.ApiAuthorizationType.NONE, get: true});
    I get an error on
    _this_.api.attachPermissions([props?.table as sst.Table]);
    in my
    MyApiStack
    class which is generalizing all this. The error that i get is "The specified permissions are not supported". This error is easily fixed if i pass a table object in
    MyApiStack(app, "myapi", {authType: sst.ApiAuthorizationType.NONE, get: true, table: myTable});
    But I want to find a way where i could skip passing a table object and based on object type (null etc) i avoid attaching permissions. I have already tried this code but it didn;t work
    Copy code
    if (props?.table !== null) {
          this.api.attachPermissions([props?.table as sst.Table]);
        }
    t
    • 2
    • 9
  • a

    Adrián Mouly

    10/27/2021, 11:53 PM
    Hey guys… not sure if my configurations changed, or maybe Epsagon changed… but my logs are resumed now, I’m getting logs like:
    Copy code
    2021-10-27T23:30:12.153Z	2772b747-ee0b-4dfa-b52e-cad56bfe548a	DEBUG	yu - send:key customerId
    2021-10-27T23:30:12.153Z	2772b747-ee0b-4dfa-b52e-cad56bfe548a	DEBUG	m_ - input: { customerId: 'e931191d-1992-4957-a901-8d3930d63f50' }
    2021-10-27T23:30:12.153Z	2772b747-ee0b-4dfa-b52e-cad56bfe548a	INFO	e_ - execute start
    This before had way more information… looks like class name is reduced into
    yu
    m_
    and
    e_
    …. and also similar thing happens with the SQL queries when are printed.
    f
    t
    • 3
    • 7
  • a

    Adrián Mouly

    10/28/2021, 5:14 AM
    Getting this error:
    Copy code
    Error: Lambda Functions in a public subnet can NOT access the internet. If you are aware of this limitation and would still like to place the function int a public subnet, set `allowPublicSubnet` to true
    Apparently one of my AWS accounts has wrong setup. Can anybody tell me where this flag has to be setup? Also looks like there is a typo… it says
    int
    .
    s
    • 2
    • 43
  • s

    Seth Geoghegan

    10/28/2021, 3:49 PM
    I'm in the process of automating the deployment of my python SST app using CircleCI and am coming up against an issue around how SST is managing python packages within docker during the build process.
    s
    s
    • 3
    • 9
  • a

    Adrián Mouly

    10/29/2021, 3:51 AM
    Anybody using WAF with CloudFront web-app? Want to configure WAF from CDK for my React site but not sure how to… Also need to use WAF with API GW v2, looks like is not that easy as it is with API GW v1.
    s
    • 2
    • 7
  • a

    Adrián Mouly

    10/29/2021, 4:13 AM
    Doing preps for Release on Monday, going live with a new app built with SST + old app built in SLS migrated to SST: In total 24 stacks defined in CDK/SST 🙂 3 websites, 5 or 6 API GW, 2 WAF, like 6 EBridge, and not sure how many lambdas 😂 . Oh and also… 3 totally different domains with subdomains… which is driving me crazy due some of them are not hosted in AWS.
    a
    j
    • 3
    • 7
  • r

    Ross Coundon

    10/29/2021, 7:58 AM
    I've noticed that most (maybe all) SST created constructs are given a name that includes the stage name. Cognito seems to be the exception, is this possible to change?
    j
    t
    f
    • 4
    • 6
  • j

    Joe Kendal

    10/29/2021, 9:10 AM
    I am wondering what your choice of monitoring solution is? Pure AWS, Sentry, Lumigo?
    t
    a
    • 3
    • 2
  • m

    Michael Clifford

    10/29/2021, 4:42 PM
    Suggestion: It would be great if there was a
    sst info
    type command that output information of a given stack (like outputs)
    t
    • 2
    • 1
  • ö

    Ömer Toraman

    10/30/2021, 2:09 PM
    I guess it makes sense to include
    @types/node
    in the TypeScript template for SST.
    t
    j
    • 3
    • 7
  • a

    Adrián Mouly

    10/31/2021, 1:54 AM
    Do you guys thought in a way to share or type the environment variables? For example on my Lambda definition in SST, have to declare:
    Copy code
    environment: {
    MY_VAR: 'my value'
    }
    And then in the function implementation..
    Copy code
    var MY_VAR = process.env.MY_VAR;
    I’m looking for a way to declare the
    MY_VAR
    definition in a single place, that can avoid any possible renaming issue, or whatever. Also would like to avoid developers to “read” environment variables from random places in the code. I would like to know easily, which are the implemented “inputs” from the environment.
    t
    • 2
    • 19
  • a

    Adrián Mouly

    10/31/2021, 2:03 AM
    Does anybody have different coloring when running commands like
    build
    ,
    diff
    or
    deploy
    ? When running “diff” my console shows a lot of nice colors for the SST output, but that doesn’t happen for “build”. Why there is inconsistency on those outputs?
    t
    f
    • 3
    • 31
  • ö

    Ömer Toraman

    10/31/2021, 9:12 PM
    Hello. Is it possible to use Babel for SST app? The latest release ( 7.16.0 ) seems cool. It supports pipeline operator proposal. https://babeljs.io/blog/2021/10/29/7.16.0
    t
    m
    • 3
    • 5
  • m

    Muhammad Ali

    11/01/2021, 8:26 PM
    I am trying to setup cognito which would use JWT and i am getting error that
    There is already a construct with name UserPool
    Here is my code and detailed error response at the bottom.
    Copy code
    export default class MyStack extends sst.Stack {
      public readonly authorizer: apigAuthorizers.HttpUserPoolAuthorizer;
    
      constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
        super(scope, id, props);
    
        //Setting up auth
        const userPool = new cognito.UserPool(this, 'UserPool', {
          selfSignUpEnabled: true,
          signInAliases: {email: true},
          signInCaseSensitive: false,
        });
    
        const userPoolclient = new cognito.UserPoolClient(this, 'UserPoolClient', {
          userPool: userPool,
          authFlows: {userPassword: true},
          idTokenValidity: Duration.days(1),
        });
    
        this.authorizer = new apigAuthorizers.HttpUserPoolAuthorizer({
          userPool: userPool,
          userPoolClient: userPoolclient,
        });
        //end up auth setup
    
        // Create a HTTP API
        const api = new sst.Api(this, "Api", {
          routes: {
            "GET /heartbeat": "src/lambda.heartbeat",
          },
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          "ApiEndpoint": api.url,
          "UserPool": userPool.userPoolId,
          "UserPoolClient": userPoolclient.userPoolClientId,
        });
      }
    and i am getting error
    Copy code
    Error: There is already a Construct with name 'UserPool' in MyStack [serverlessnotesapp-rest-api-ts-my-stack]
        at Node.addChild (/Users/username/prjs/rest-api-ts/node_modules/constructs/src/construct.ts:381:13)
        at new Node (/Users/username/prjs/rest-api-ts/node_modules/constructs/src/construct.ts:58:22)
        at new ConstructNode (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/construct-compat.ts:184:24)
        at Object.createNode (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/construct-compat.ts:55:11)
        at new Construct (/Users/username/prjs/rest-api-ts/node_modules/constructs/src/construct.ts:409:26)
        at new Construct (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/construct-compat.ts:52:5)
        at new CfnElement (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/cfn-element.ts:31:5)
        at new CfnOutput (/Users/username/prjs/rest-api-ts/node_modules/@aws-cdk/core/lib/cfn-output.ts:26:5)
        at /Users/username/prjs/rest-api-ts/node_modules/@serverless-stack/resources/src/Stack.ts:84:9
        at Array.forEach (<anonymous>)
    t
    • 2
    • 2
  • c

    Clayton

    11/01/2021, 10:55 PM
    It looks like when you do a boilerplate install of SST using
    npx create-serverless-stack@latest
    - • it installs an older version (0.4.5) • has a lot of dependencies vulnerabilities - I see some older posts on this and a pending backlog issue, but should it be a concern with this many high and critical warnings?
    t
    a
    • 3
    • 7
  • c

    Clayton

    11/01/2021, 10:56 PM
    Also, when you run
    npx sst update 0.50.2
    to try and update it errors out with
    Unknown script "update"
    t
    f
    • 3
    • 7
  • m

    Muhammad Ali

    11/02/2021, 3:00 AM
    I am setting JWT authentication (set it up successfully). Since i am targeting mobile app, i am trying to think about ways to reduce network IO. One of the thing i want to do that as part of
    sign-in
    request, I want to add some basic info for user so that their home screen can be rendered. was thinking to return this info as part of sign in request and inject it using some cognito trigger. I setup these triggers
    Copy code
    const auth = new sst.Auth(this, "Auth", {
      cognito: {
        userPool: userPool,
        userPoolClient: userPoolclient,
        triggers: {
          postAuthentication: "src/lambdas/cognito.postAuthentication",
          preTokenGeneration: "src/lambdas/cognito.preTokenGeneration",
          preAuthentication: "src/lambdas/cognito.preAuthentication",
        },
     },
    });
    and when i do
    aws cognito-idp sign-up
    ->
    aws cognito-idp admin-confirm-sign-up
    ->
    aws cognito-idp initiate-auth
    ... none of these triggers get triggered. The code for trigger look like this
    Copy code
    export const preTokenGeneration: APIGatewayProxyHandlerV2 = async (event) => {
      console.log(event);
      return {
        statusCode: 200,
        headers: { "Content-Type": "text/plain" },
        body: `This is from preTokenGeneration ${event.requestContext.time}.`,
      };
    };
    s
    f
    • 3
    • 12
  • r

    Ross Coundon

    11/02/2021, 1:29 PM
    Has anyone any experience of deploying Thundra APM with SST? Just had the demo and they have a killer feature of being able to examine each line of code in a trace to see what values were set on each variable at any time. Their deployment requires a lambda layer which is fine but also a custom runtime. Seems like this would be fine, although running code on a Thundra version of node rather than the standard version feels a bit scary
    t
    a
    +2
    • 5
    • 25
  • r

    Ross Coundon

    11/02/2021, 4:45 PM
    We're seeing the error:
    Copy code
    Replacement type updates not supported on stack with disable-rollback.
    We had to rename a table in the stack as its definition had changed, after doing so we get this error. What's the recommendation to deal with this?
    f
    t
    +3
    • 6
    • 57
  • s

    Seth Geoghegan

    11/02/2021, 9:57 PM
    I'm trying to set the
    AWS_CONFIG_FILE
    parameter when running
    sst start
    so I can specify a location of an alternative
    ~/.aws/config
    file
    m
    • 2
    • 13
  • a

    Adrián Mouly

    11/02/2021, 10:06 PM
    No question this time… If feels so good to use the
    permissions
    attribute on the constructs from SST/CDK… no extra permissions flying around. Also is really clear what has permissions over what… Before with SLS this was a pain, and we ended up using
    *
    everywhere… Everything had access to everything. Feels so good to have clean and understandable code… this makes me enjoy my job 😄
    ö
    f
    • 3
    • 2
  • m

    Muhammad Ali

    11/03/2021, 3:48 AM
    Hey everyone, another question regarding stack naming. It looks like sst creates stack using following naming convention
    <aws_username>-<proj-name>-<stack-name>
    . Is there a way i can remove
    <aws_username>
    from this convention or at least specify a custom name here?
    t
    • 2
    • 3
  • r

    Ross Coundon

    11/03/2021, 11:07 AM
    Is there a way to run integration tests interactively during the development process. As an example, previously, when using serverless framework, I'd typically have dynamodb local running and run some tests directly using the jest-runner vscode plugin by customising the endpoint. I'd like to do the same but with a real dynamodb table. I'm about to start tinkering with this but wondered what others have found
    s
    t
    • 3
    • 43
  • r

    Ross Coundon

    11/03/2021, 1:29 PM
    Hit a bit of a snag with Thundra, it requires a custom runtime and SST only supports a selection of standard runtimes
    Copy code
    Error: The specified runtime is not supported for sst.Function. Only NodeJS, Python, Go, and .NET runtimes are currently supported.
    Is this a deal breaker?
    t
    a
    • 3
    • 11
  • t

    Tharshan

    11/03/2021, 1:37 PM
    Hey folks - what is everyone here using for their end to end error reporting? I have a nextjs app deployed with pages and api routes and some pages are giving 503. (No issues with local dev ). What has been the best experience for error reporting across the stack? Sentry? datadog? something else?
    t
    • 2
    • 6
  • c

    Clayton

    11/03/2021, 2:04 PM
    Is it possible to use the current EventBus construct with a Kinesis Stream set as the target? If not, @Frank is this something that could be added? I’m trying to reproduce this Serverless Framework template - https://github.com/jgilbert01/aws-lambda-stream/blob/master/templates/event-hub/serverless.yml The goal is to create a service that consumes all events from other services via EventBridge and and utilizes Kinesis to help apply batching and back pressure for publishing of events to functions – https://medium.com/@jgilbert001/combining-the-best-of-aws-eventbridge-and-aws-kinesis-9b363b043ade
    t
    g
    f
    • 4
    • 37
  • k

    Kevin Baker

    11/03/2021, 2:31 PM
    Are there any common patters for data migrations and or seeding data for SST/CDK? or is this more of a dependency on ORM/DAL selection
    t
    o
    • 3
    • 11
  • m

    Michael Clifford

    11/03/2021, 4:37 PM
    Hey guys, any chance of this becoming a priority soon: https://github.com/serverless-stack/serverless-stack/issues/932?
    t
    • 2
    • 1
1...171819...33Latest