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

    Orlando

    04/21/2022, 4:37 PM
    Hi all, we just updated sst from 0.53.3 to 0.69.6. Everything is working well in production. However, we’re seeing an issue where live lambda gets hung up and then times out on all lambda functions wrapped with a Sentry handler. Sentry is set up like this where its only conditionally attached to prod deploy, and not on local. Any ideas why we might be seeing this issue?
    t
    f
    • 3
    • 14
  • e

    Erik Robertson

    04/21/2022, 9:46 PM
    Hello all. Just upgraded to 1.0. All went well and is working but I have a type warning
    Copy code
    Index signature for type 'string' is missing in type '{}'.
    on the environment line in the following statement (this refers to the stack)
    Copy code
    this.setDefaultFunctionProps({
          environment: config,
          bundle: {
            externalModules: ['pg-hstore'],
            nodeModules: ['mysql2']
          },
          timeout: 20,
        })
    and config is declared as
    Copy code
    let config = {}
    and has key/value pairs added to it before the setDefaultFunctionProps call. Any idea what I can do to get rid of that error ?
    t
    f
    • 3
    • 5
  • h

    Hans Song

    04/22/2022, 12:08 AM
    hey guys, running into this type error:
    Copy code
    const authorizer = new HttpLambdaAuthorizer(
      "Authorizer",
      new sst.Function(this, "Authorizer", {})
    );
    
    const api = new sst.Api(this, "Api", {
      defaultAuthorizationType: sst.ApiAuthorizationType.CUSTOM,
      defaultAuthorizer: authorizer,
      ^
    Type 'HttpLambdaAuthorizer' is not assignable to type 'HttpJwtAuthorizer | HttpLambdaAuthorizer | HttpUserPoolAuthorizer | undefined'.
      Property 'pool' is missing in type 'HttpLambdaAuthorizer' but required in type 'HttpUserPoolAuthorizer'.
    f
    • 2
    • 8
  • c

    Casiel Didriksson Muriedas

    04/22/2022, 2:42 PM
    Hello anyone else having problems with ESLint after upgrade to 1.0.0-beta.21?
    t
    • 2
    • 16
  • h

    Harris Newsteder

    04/22/2022, 5:53 PM
    trying to deploy and i'm getting a new error saying it can't bundle pg-native
    t
    f
    • 3
    • 10
  • f

    Fatih Erdinç

    04/23/2022, 3:44 PM
    Hi everyone, could you help me? How can i import "x-api-key" for sst.Api and check in header? Anyone has example ?
    Copy code
    const api = new sst.Api(this, "Api", {
        routes: {
            "GET /students": "src/api/get.main",
        },
        defaultFunctionProps: {
            environment: {
                BUCKET_NAME: bucket.bucketName,
            },
            permissions: [bucket],
        }
    });
    
    this.addOutputs({
        "ApiEndpoint": api.url,
    });
    f
    r
    b
    • 4
    • 10
  • j

    John

    04/23/2022, 8:13 PM
    Hey guys, I have configured my
    SST.API
    with the following -
    Copy code
    customDomain: {
      domainName: '<http://api.boxitoff.com|api.boxitoff.com>',
      hostedZone: '<http://api.boxitoff.com|api.boxitoff.com>',
    }
    and have setup that zone in Route 53 - `api.boxitoff.com`but when I try to deploy using Seed I get (at the end of the deploy) -
    Copy code
    ❌ prod-backend-api: No hosted zone found with ID: xxxxxx (Service: AmazonRoute53; Status Code: 404; Error Code: NoSuchHostedZone; Request ID: xxxxx; Proxy: null)
    Apologies if I've missed something in the docs but I've been working on this for a few hours now and have made progress yet still stuck at this point. Preiously I didn't have the
    hostedZone
    value set
    a
    a
    f
    • 4
    • 8
  • j

    justindra

    04/23/2022, 10:02 PM
    Hey guys, does anyone know how to do an ElasticSearch (OpenSearch) destination for Firehose using the L2 Constructs? They seem to have removed it. Or if not, any ideas on how to use the L1 constructs while using CDKv2?
    f
    • 2
    • 8
  • d

    Dillon Peterson

    04/23/2022, 11:52 PM
    It looks like SST is setting up the Federated identity stuff on the backend, and I'm passing the config info into the front-end (Federated Identity Pool ID), but I'm not really sure what function I should be using to have user be re-directed to Twitter, and callback url to ping Cognito?
    f
    • 2
    • 1
  • n

    Neel

    04/24/2022, 12:35 AM
    I am trying to implement CodePipeline. And it seems it's not picking up my template.json file automatically when I try to deploy code. The PULLSOURCE & BUILDSOURCE pipeline are working just fine.
    Copy code
    versions_pipeline.addStage({
          stageName: "PipelineUpdate",
          actions: [
            new CloudFormationCreateUpdateStackAction({
              actionName: "PipelineUpdate",
              stackName: "PipelineStack",
              templatePath: buildOutput.atPath(
                "cdk-my-sst-app-versions-pipeline.template.json"
              ),
              adminPermissions: true,
            }),
          ],
        });
    I am following a aws-cdk infra tutorial and trying it on SST. The below line is giving error.
    Copy code
    templatePath: buildOutput.atPath(
         "cdk-my-sst-app-versions-pipeline.template.json"
    ),
    I guess buildOutput.atPath looks into my buildArtifact and it tries to findout my template.json. But the folderstructure is different from aws-cdk. I am not sure if I am right in saying this. The below is the error.
    Copy code
    File [cdk-my-sst-app-versions-pipeline.template.json] does not exist in artifact [VersionBuild]
    Thanks for the help. Below is my whole PipeLineStack that I am creating. I am failing at third stage (PipelineUpdate).
    Copy code
    import { App, Stack, StackProps } from "@serverless-stack/resources";
    import { SecretValue } from "aws-cdk-lib";
    import {
      BuildSpec,
      LinuxBuildImage,
      PipelineProject,
    } from "aws-cdk-lib/aws-codebuild";
    import { Artifact, Pipeline } from "aws-cdk-lib/aws-codepipeline";
    import {
      CloudFormationCreateUpdateStackAction,
      CodeBuildAction,
      GitHubSourceAction,
    } from "aws-cdk-lib/aws-codepipeline-actions";
    
    export class PipelineStack extends Stack {
      constructor(scope: App, id: string, props: StackProps) {
        super(scope, id, props);
    
        const versions_pipeline = new Pipeline(this, "VersionsPipeline", {
          pipelineName: "VersionPipeline",
          crossAccountKeys: false,
        });
    
        const sourceOutput = new Artifact("VersionsSource");
    
        versions_pipeline.addStage({
          stageName: "Source",
          actions: [
            new GitHubSourceAction({
              owner: "my-git-username",
              repo: "my-git-repo",
              branch: "main",
              actionName: "PipelineSource",
              oauthToken: SecretValue.secretsManager("github-pipeline-secret"),
              output: sourceOutput,
            }),
          ],
        });
    
        const buildOutput = new Artifact("VersionBuild");
        versions_pipeline.addStage({
          stageName: "VersionBuild",
          actions: [
            new CodeBuildAction({
              actionName: "VersionBuild",
              input: sourceOutput,
              outputs: [buildOutput],
              project: new PipelineProject(this, "VersionBuildProject", {
                environment: {
                  buildImage: LinuxBuildImage.STANDARD_5_0,
                },
                buildSpec: BuildSpec.fromSourceFilename("versions-build-spec.yml"),
              }),
            }),
          ],
        });
    
        versions_pipeline.addStage({
          stageName: "PipelineUpdate",
          actions: [
            new CloudFormationCreateUpdateStackAction({
              actionName: "PipelineUpdate",
              stackName: "PipelineStack",
              templatePath: buildOutput.atPath(
                "cdk-my-sst-app-versions-pipeline.template.json"
              ),
              adminPermissions: true,
            }),
          ],
        });
      }
    }
    f
    • 2
    • 4
  • r

    Rudi

    04/24/2022, 1:08 AM
    I'm rolling a simple home grown event source system using SST, I have two approaches I'd like to get feedback on. These are two options I'm considering: 1) Publish event to Event Bridge, one of the consumers will read and then write the event to S3 for long term storage of all these events. or 2) Write/Save the event direct to S3, then have an S3 event trigger a lambda to publish it to Event Bridge. Both approaches save the event to S3 - which do you prefer? Any pitfalls to either approach you're aware of?
    t
    a
    a
    • 4
    • 24
  • a

    Ashishkumar Pandey

    04/24/2022, 11:43 AM
    This might be obvious and stupid but can I use JWT authorizer with my custom jwt implementation? Like I have my custom signup / signin endpoint that generates the token. Could someone verify if this will work or will I need to use Lambda authorizers to implement this?
    b
    f
    • 3
    • 4
  • p

    Peter Slattery

    04/24/2022, 2:59 PM
    I'm having some trouble with referencing a Table in a different stack than it was created in. The problem appears when I call
    npx sst build
    - I get the following error (followed by a stacktrace I can post if helpful)
    Copy code
    Error: Resolution error: Resolution error: Resolution error: Trying to resolve() a Construct at /Resources/${Token[ps-dev-sketching-stack-websocket.websocket-api..connect.Resource.LogicalID.352]}/Properties/environment/variables/table_games_live/node.
    If I stop referencing the table across stacks, everything builds just fine - though I can't access the table then. It seems like this should work, according to docs here: https://docs.serverless-stack.com/advanced/cross-stack-references I'll post code snippets in the thread.
    t
    • 2
    • 14
  • k

    Kristian Lake

    04/24/2022, 7:31 PM
    hey guys, is there a way to set this from email address in the code? (cognito)
    f
    • 2
    • 6
  • r

    Robert Chandler

    04/25/2022, 12:05 AM
    I'm trying to set up a new React frontend in our mono repo but I keep hitting an issue where we end up with two different React versions in our workspace for seemingly no reason which ends up in an error
    Copy code
    react.development.js:209 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
    1. You might have mismatching versions of React and the renderer (such as React DOM)
    2. You might be breaking the Rules of Hooks
    3. You might have more than one copy of React in the same app
    When these frontends were located in separate repos they both used React 17, now they're in with the serverless stack they're both using React 18 despite the root
    node_modules
    having React 17 in it and all
    package.json
    files have
    "^17.0.2"
    as the version. The repo is setup with a
    package.json
    in the root which includes workspaces for the two frontend directories which each have their own
    package.json
    , I'm currently using
    npm
    Any help would be much appreciated, I've been trying to work this out for the last few hours! 🤯
    t
    • 2
    • 3
  • r

    Rudi

    04/25/2022, 5:33 AM
    Hi, I'm struggling to make typescript happy for a simple EventBridgeHandler function .. I hope someone can point out where I'm going wrong:
    c
    r
    b
    • 4
    • 17
  • p

    Peter Slattery

    04/25/2022, 11:36 AM
    Is it possible to add a path to an sst.Api without setting a domain name? Or, if not, to get the domain name that would have been generated automatically? Basically I just want to use the default domain name and append "/v2" on the end, so that all calls to the api look like "<default domain name>/v2/<api route>" For context, I get an error saying I have to supply a domainName if I do this:
    Copy code
    this.api = new sst.Api(
      this, 
      "api-name", 
      {
        customDomain: {
          path: "v2"
        }
      }
    );
    h
    f
    • 3
    • 5
  • a

    Alex Rayo

    04/25/2022, 5:58 PM
    QQ. I need to have some required and optional path params for a Lambda and wondering how best to implement this. For example, in Node + Express one might refine a route like
    /someResource/:someId/:optionalThing?/:otherOptionalThing?
    What are people generally doing with SST? Thanks!
    t
    • 2
    • 3
  • r

    Ryan Barnes

    04/25/2022, 7:26 PM
    Hey team, I'm getting an error
    Runtime.ImportModuleError: Unable to import module 'handlers/alerts/demo_read_db': No module named 'marshmallow'
    and I'm thinking this is bundling issue. I notice that the actual deployed lambda function isn't running a docker container. This is my cron job def
    Copy code
    this.cron = new sst.Cron(this, 'cron', {
                schedule: Duration.minutes(1),
                job: {
                    // check the docs here to see what you can pass into the function props
                    // <https://docs.serverless-stack.com/constructs/Function>
                    function: {
                        runtime: 'python3.9',
                        srcPath: 'src',
                        handler: 'handlers/alerts/demo_read_db.handler',
                        bundle: {
                            installCommands: [
                                'yum -y install mariadb-devel gcc',
                                'pip install -r requirements.txt',
                            ],
                        },
                    },
                },
            });
    This is my requirements file that defines marshmallow
    Copy code
    sqlalchemy-aurora-data-api==0.4.0
    SQLAlchemy==1.4.23
    flask-sqlalchemy
    marshmallow==3.13.0
    marshmallow-sqlalchemy==0.26.1
    mysqlclient==2.0.3
    When I run
    npx sst deploy --stage prod
    I see on the cli that docker is building a container, yum installs packages, and pip installs packages (snippet in thread). However when I go into the aws console and look at the code I just see bare code source (screenshot) and I notice that the package source is via zip. The lambda doesn't seem to have any access to the packages that are installed in the requirements file. Any ideas?
    f
    • 2
    • 8
  • ö

    Ömer Toraman

    04/25/2022, 7:34 PM
    Any example of Lerna SST app? (other than this)?
    f
    • 2
    • 4
  • r

    Ross Coundon

    04/25/2022, 8:32 PM
    I’m trying to upgrade an app from 0.67.0 to 1.0.0-beta.23 and I’m getting deployment failure due to the stage already existing.
    Copy code
    Stage already exists (Service: AmazonApiGatewayV2; Status Code: 409; Error Code: ConflictException; Request ID: d4d312c4-82e8-44a2-9b16-97c4f9f7b7b7; Proxy: null)
    console.js:6
    I’ve switched to
    Copy code
    const api = new sst.Api(this, 'Api', {
          cdk: {
            httpApi: {
              createDefaultStage: false,
            },
            httpStages: [{
              stageName: this.stage,
              autoDeploy: true,
            }]
          },
    ...
    from the previous separate definition
    Copy code
    const apiStage = new HttpStage(this, 'Stage', {
          httpApi: api.httpApi,
          stageName: this.stage,
          autoDeploy: true,
        });
    Have I done something wrong here?
    f
    • 2
    • 12
  • t

    Tanner Bindrup

    04/25/2022, 9:12 PM
    Hey all - I'm trying to transition a lambda that uses
    chrome-aws-lambda
    from Serverless Framework over to SST and keep running into this error when deployed:
    Copy code
    WARN	Error: Failed to launch the browser process!
    /tmp/chromium: /tmp/chromium: cannot execute binary file
    Anyone seen this before and worked through it? I feel like I've scoured the internet with no trace of anything helpful... Of note, it was working just fine with
    chrome-aws-lambda
    in a layer on Serverless Framework, so I know it's possible. And the layer is loaded into my lambda according to the AWS console. I don't even know where else to look at this point
    f
    • 2
    • 2
  • b

    Bshr Ramadan

    04/25/2022, 10:17 PM
    Hello I have many nextjs-site constructs. On building, I noticed that often many of them is being built a twice, and that causing the deployment taking a long time (about 45 mins) can any help me to debug this?
    f
    • 2
    • 5
  • i

    Islam Salem

    04/25/2022, 10:56 PM
    Hi guys, I’m trying to set SES email receiving feature in which a lambda will be triggered every time an email is sent to a sub domain. I’m using SST and the main region I use is
    eu-central-1
    but unfortunately I found that SES email receiving feature (ReceiptRuleSet) isn’t enabled on this region. so I’ve tried set up another stack on a different region
    eu-west-1
    so I’m looking for help if anyone has done something similar to have stacks on different regions on the same app. I don’t know how should I run the
    sst start
    command as it’s by default deploying all stacks to the main region. I also found this thread https://serverless-stack.slack.com/archives/C01JG3B20RY/p1643119080123400 and wanted to follow up on it, if there’re any updates as mentioned it would be discussed internally @Jay
    f
    • 2
    • 7
  • b

    Bshr Ramadan

    04/25/2022, 10:58 PM
    Another problem: I getting this error:
    Copy code
    AWS::Logs::LogGroup' with identifier /aws/vendedlogs/apis/.. was not found
    I use
    app.setDefaultFunctionProps
    to set logs retention for all lambdas and don't use
    accessLog
    property of Api (it's true by default) am I doing anything in a wrong way?
    f
    j
    • 3
    • 5
  • h

    Hans Song

    04/26/2022, 1:56 AM
    hey guys, didn’t really get an answer to this one my versions
    Copy code
    SST 0.69.7
    CDK 2.15.0
    It seems the api doesn’t respect per route authorization settings
    f
    • 2
    • 8
  • j

    John Stephen Soriao

    04/26/2022, 5:58 AM
    Hello. How do you handle automation with dynamodb table replacement? For example, in development, I changed the primary keys of the dynamodb table. This will require replacement but will result to an error since it uses the same table name. There is an option of course to use for example the build number for uniqueness of the table name. Still, I would like to automate restoring data from the last backup of the table to be replaced. I just want to know how you would handle this kind of situation
    f
    • 2
    • 2
  • s

    Scott

    04/26/2022, 7:49 AM
    * Worked out this was related to SST Console, as the way I was passing in the body seems incorrect. Passing the body via Postman worked * Hello, I've been following the guide from serverless-stack for middy setup here - https://serverless-stack.com/examples/how-to-use-middy-to-validate-your-serverless-api-requests.html I've noticed the guide suggests accessing fields via:
    Copy code
    const { fname, lname } = event.body;
    But when talking about the SST console it shows utilizing the Query tab rather than Body tab for API requests. Which seems odd and doesn't work for me, instead I add them to the body tab, is this an inaccuracy in the guide or on my end? When applying the inputSchema as prescribed in the tutorial, I seem to run into an error validating the template. No matter what body is passed in correct or incorrect same error occurs as shown in the snippet below. Any suggestions on what I could try would be much appreciated
    f
    m
    • 3
    • 3
  • k

    Karolis Stulgys

    04/26/2022, 8:47 AM
    Hi. How can I make my nestjs server serverless with serverless-stack?
    f
    • 2
    • 9
  • b

    Brinsley

    04/26/2022, 10:21 AM
    Hey guys, super quick (probably stupid) question about external lambda authorizer on an API. Using v1 it looks like this sort of thing has been affected and I'm trying to figure out the "correct" way to do this. This is what I have:
    Copy code
    new Api(this, "api", {
                authorizers: {
                    "custom-auth": {
                        type: "lambda",
                        function: Function.fromFunctionArn(this, "custom-auth", "my-lambda-arn"),
                    }
                }
            });
    This gives me an error:
    Copy code
    Type 'IFunction' is missing the following properties from type 'Function': _isLiveDevEnabled, localId, attachPermissions, getConstructMetadata, and 33 more.
    So I guess I should actually be using the
    cdk.authorizer
    with a
    HttpLAmbdaAuthorizer
    construct instead? (seem to have lost where to import that class from 😞)
    t
    f
    • 3
    • 15
1...666768...83Latest