https://serverless-stack.com/ logo
Join Slack
Powered by
# help
  • j

    Jett Robin Andres

    11/20/2021, 1:06 PM
    I need some help with setting up my cognito. Is there a proper way to expose
    environment
    variables to my
    preTokenGeneration
    and
    postAuthentication
    handlers? I’m forced to use the old(?) handler interface
    a
    m
    f
    • 4
    • 10
  • j

    Jon Holman

    11/21/2021, 3:11 PM
    I'm having some confusion with
    attachPermissions
    . This does not work, I get an error `Error: The specified grant method is incorrect.`:
    Copy code
    scheduled.attachPermissions([
          [topic, "grantPublish"],
          [table, "grantReadData"],
        ]);
    but this does work, no errors:
    Copy code
    scheduled.attachPermissions([topic, "grantPublish"]);
        scheduled.attachPermissions([table, "grantReadData"]);
    Can someone explain this to me? I thought both would work.
    f
    ö
    • 3
    • 15
  • a

    Adrian Schweizer

    11/21/2021, 11:21 PM
    i have an ses:sendMail policy in my api stack that works in the local dev environment, but doesn't work on prod...any idea why?
    s
    f
    t
    • 4
    • 28
  • k

    karthik

    11/22/2021, 3:31 PM
    hi @Frank, hopefully a quick one - say for ex, I want to expose the bucket (where the notes are stored) as a static site - what would be the construct using sst StaticSite? essentially looking for a construct to expose a S3 bucket via a CF distribution. I dont have a “path” per se as I want the contents (say publicly accessible images) of the S3 bucket to be exposed via a custom domain..
    t
    f
    • 3
    • 9
  • m

    Matt Morgan

    11/22/2021, 4:29 PM
    I was able to get permission boundaries to work with SST but I'm wondering if anybody has thought about a way to add them to the debug stack? We have the same permission boundaries in our dev environments we do in prod, thereby to encounter any problems ASAP. That means we can't deploy the debug stack.
    f
    • 2
    • 5
  • j

    jamlen

    11/22/2021, 5:17 PM
    Can I have a Stack that only deploys in certain envs - either whitelist or blacklist? My usecase is that I need to stand up a dummy API to mock out an external integration and I want to deploy that in environments except prod, staging etc.
    o
    • 2
    • 3
  • a

    Aram

    11/23/2021, 9:44 AM
    Hey folks, getting this error when trying to deploy a simple sst stack generated by npx command with flags --language typescript and --use-yarn using yarn v3.0.1
    Copy code
    ❯ yarn deploy --stage aram
    
    Error: stun tried to access message, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
    
    Required package: message (via "message/request")
    Required by: stun@npm:2.1.0 (via /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/stun-npm-2.1.0-5ba87bba22-d964760229.zip/node_modules/stun/src/)
    
    Require stack:
    - /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/stun-npm-2.1.0-5ba87bba22-d964760229.zip/node_modules/stun/src/index.js
    - /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-core-npm-0.53.0-2f054eeef8-dc03eb25e8.zip/node_modules/@serverless-stack/core/dist/bridge/bridge.js
    - /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-core-npm-0.53.0-2f054eeef8-dc03eb25e8.zip/node_modules/@serverless-stack/core/dist/bridge/index.js
    - /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-core-npm-0.53.0-2f054eeef8-dc03eb25e8.zip/node_modules/@serverless-stack/core/dist/index.js
    - /Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/@serverless-stack-cli-npm-0.53.0-9f38e44115-8dbaebbf98.zip/node_modules/@serverless-stack/cli/bin/scripts.js
        at Function.external_module_.Module._resolveFilename (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.pnp.cjs:36232:55)
        at Function.external_module_.Module._load (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.pnp.cjs:36031:48)
        at Module.require (internal/modules/cjs/loader.js:952:19)
        at require (internal/modules/cjs/helpers.js:88:18)
        at Object.<anonymous> (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.yarn/cache/stun-npm-2.1.0-5ba87bba22-d964760229.zip/node_modules/stun/src/index.js:3:21)
        at Module._compile (internal/modules/cjs/loader.js:1063:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
        at Module.load (internal/modules/cjs/loader.js:928:32)
        at Function.external_module_.Module._load (/Users/aramix/Freelance/VHT/sst-messaging-gateway/.pnp.cjs:36081:14)
        at Module.require (internal/modules/cjs/loader.js:952:19)
    j
    t
    • 3
    • 4
  • t

    Tharshan

    11/23/2021, 11:00 AM
    Is anyone using s3 for user uploaded images? Would love to learn what folks are doing for node
    g
    f
    • 3
    • 17
  • f

    Fazi

    11/23/2021, 11:28 AM
    Hi all, I have the following issue: 1. Dev A works on a serverless stack project and pushes all the code to git. It works when they run
    npm run start
    for debugging. 2. Dev B then clones the repo, and runs
    npm run start
    , but this throws an error :
    table xyz already exists
    What would be the best way around this?
    r
    a
    +5
    • 8
    • 20
  • g

    George Evans

    11/23/2021, 11:33 AM
    Hi! Does anyone know when will the next release be and will it include cdk v1.133.0? There are some features in that version but when I update my local cdk packages it throws all the type definitions out as SST uses v1.132.0
    f
    • 2
    • 3
  • a

    Adrian Schweizer

    11/23/2021, 1:13 PM
    Can someone recommend a good slack/discourse/irc/forum for general aws help? It seems many of my issues only have remotely something to do with SST, if at all, and I don't want to spam this slack here with mostly unrelated questions
    r
    j
    f
    • 4
    • 5
  • a

    Austin

    11/23/2021, 6:43 PM
    I’m having trouble running
    npx sst test
    against a non-default stage (something other than dev). I’ve tried
    npx sst test --stage stageName
    which the documentation seems to indicate should work, but I just get an error that the Jest CLI doesn’t support that option. What am I missing?
    f
    m
    • 3
    • 6
  • t

    Tamara Dottin

    11/23/2021, 9:20 PM
    Hi all -- have an authentication stack that creates a Cognito User Pool and Client using
    sst.Auth
    and then creates a
    cognito.UserPoolIdentityProviderGoogle
    passing in the previously created user pool. Deploying the stack is failing for one of our devs:
    The provider Google does not exist for User Pool us-east-1_xxxxxxx. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: bac404cf-aff9-4476-9167-647134a8166b; Proxy: null)
    but it's working for myself and another teammate. Has anyone experienced this? I saw mention of a race condition when creating a user pool and identity provider in the same stack here: https://github.com/aws/aws-cdk/issues/15692#issuecomment-884495678, but not sure if that's what we're experiencing
    ö
    f
    • 3
    • 9
  • d

    Dan Van Brunt

    11/23/2021, 9:30 PM
    Is there a way to set Bucket.autoDeleteObjects === true with
    sst.Bucket
    ?
    ö
    • 2
    • 2
  • g

    George Evans

    11/24/2021, 12:26 PM
    When using python runtime, is there a way to skip the default python bundling and deploy to your own docker container runtime. I tried the following which satisfies types but fails on deploy.
    Copy code
    // build from custom docker image 
    const processFunc = new lambda.DockerImageFunction(this, "ProcessGifUrl", { "code": lambda.DockerImageCode.fromImageAsset("./") });
        const func = lambda.Function.fromFunctionArn(this, "ProcessFunc", processFunc.functionArn);
    
    ...
    // api config
       routes: {
            "POST /process-gif": {
              function: func,
              methodOptions: {
                apiKeyRequired: true,
                authorizationType: AuthorizationType.NONE
              }
            },
    f
    g
    • 3
    • 16
  • s

    Sam

    11/24/2021, 3:06 PM
    Is it safe to use AWS cdk constructs within a serverless stack app? I want to make a user pool group and from what I understand there isn’t a way to add one within serverless stack so I used the
    CfnUserPoolGroup
    . It seems to be working but want to make sure it wont cause any problems down the line. I’m new to SST so thank you in advance!
    Copy code
    this.auth = new sst.Auth(this, "Auth", {
      cognito: {
        userPool: userPoolConfiguration,
    
        // Cognito triggers to run Lambdas
        triggers: {
          postConfirmation: postConfirmationConfiguration,
        },
      },
    });
    
    new CfnUserPoolGroup(this, "UserPoolAdminGroup", {
      userPoolId: this.auth.cognitoUserPool.userPoolId,
    
      description: "Administrator user group. Full access.",
      groupName: "admin",
    });
    t
    • 2
    • 2
  • g

    Gabriel Araújo

    11/24/2021, 9:59 PM
    How do i force a deploy
    t
    f
    • 3
    • 16
  • j

    Jett Robin Andres

    11/24/2021, 11:59 PM
    Hi everyone, I’m using a nodejs library to verify my Cognito JWT token being passed from the client after a successful login. I’m getting the ff error whenever I try to import the library into my lambda (see first image). Upon inspecting the library, it says in its README that it can be used in NodeJS 14 and above. I noticed that in my entry file
    stacks/index.ts
    the set default function runtime for nodeJs is just
    nodeJs12.x
    , is this the one causing the error? Other stackoverflow answers and github comments recommend updating my
    @types/node
    dependency but that still didn’t do the trick. I checked my SST version and it’s (a bit?) outdated since I started.
    Copy code
    SST: 0.45.0
    CDK: 1.125.0
    In SST v0.46.0’s changelog, there was a PR related to removal of the said node crypto package. Will updating to
    v0.46.0
    most likely solve my case? How do we go about updating SST? Would you guys recommend me to jump immediately to
    v0.53.0
    or just go about it incrementally? I’m missing out on all the good stuff too so I figured maybe it’s about time while my SST app’s still young
    ö
    f
    • 3
    • 30
  • c

    Carter Himmel

    11/25/2021, 1:53 AM
    so, i made a pr for switching to yarn 3 and used the deploy prs feature, had zero problems. but when we merged to staging, the same problem in the pic in this thread occurred
    f
    • 2
    • 16
  • n

    Noah D

    11/25/2021, 7:47 AM
    Hey has anyone had issues before where they were unable to deploy stacks locally, whenever I try to deploy I get the following error. See thread for more context
    Copy code
    Cannot convert undefined or null to object
    r
    f
    • 3
    • 19
  • k

    Kuda Zhou

    11/25/2021, 12:17 PM
    Hey guys has anyone come across this before on codebuild? Trying to deploy the sst app but having issues with yarn deploy command
    t
    • 2
    • 3
  • k

    Koen A

    11/25/2021, 1:37 PM
    Hi, for my current project I am using expressJS for my Lambda functions to be able to use the tsoa library to easily generate OpenAPI documentation. The idea is that for each domain or microservice, a route in the sst.Api construct is routed to a function that uses expressJS that further routes to a specific REST method. Also implemented with versioning. Something like:
    Copy code
    routes: {
    "ANY /{version}/users/*" ... => expressJS Lambda function that routes to specific API method
    "ANY /{version}/payments/*" ... => expressJS Lambda function that routes to specific API method
    }
    At the moment I can do:
    Copy code
    routes: {
    "ANY /v1/users/{proxy+}", ... => expressJS Lambda function for GET/PUT/DELETE
    "ANY /v1/users", ... => expressJS Lambda function for POST
    "ANY /v1/payments/{proxy+}", ... => expressJS Lambda function for GET/PUT/DELETE
    "ANY /v1/payments", ... => expressJS Lambda function for POST
    "ANY /v2/payments/{proxy+}", ... => expressJS Lambda function for GET/PUT/DELETE
    "ANY /v2/payments", ... => expressJS Lambda function for POST
    }
    Is this a valid approach to route to a Lambda function per service and to use versioning?
    ö
    f
    • 3
    • 6
  • p

    Pavan Kumar

    11/25/2021, 4:21 PM
    Is it possible to deploy a stack to multiple region. Something as follows.
    Copy code
    new StackA()
    new StackB()
    for (const region of ['us-east-1', 'us-east-2']) {
      new StackC(region)
    }
    ö
    f
    t
    • 4
    • 22
  • e

    Erik Robertson

    11/25/2021, 4:46 PM
    Hello all. Is any of you aware of a size limit to what a lambda fucntion can output ? I have an API call that works fine for a 3.84MB json output but not for double that (7.6 MB). The lambda just fails returning ""Internal Server Error" without even throwing an exception as if this was happening beyond my lambda function code (since I have an exception catch there and it doesn't hit it)
    r
    s
    ö
    • 4
    • 9
  • d

    Dan Coates

    11/25/2021, 11:48 PM
    Hi all, we're noticing that often when devving apis locally via
    sst start
    that requests to the api are timing out after 10 seconds with an "Internal server error". A few other observations from trying to diagnose this issue: • It only happens when running locally with
    sst start
    not once the code is deployed • The sst logs also often display an error
    Unexpected Top Level Error: Error: socket hang up
    though hard to tell if this is the cause of the issue. • The api normally responds in under 100ms so it isn't just our code hitting the default 10s timeout • This is happening to multiple developers in multiple locations so probably not an issue on the local network • The error is intermittent, after a 500 error if you make the same request a few more times it generally starts working eventually • After a 500 error occurs, if you save the relevant handler file and re-request it seems to work (hard to tell for sure because of the above point) • We're on the latest version of the cli
    ^0.53.0
    f
    t
    m
    • 4
    • 9
  • g

    gio

    11/26/2021, 8:51 AM
    Hello guys, I have a problem with JSDOM library. When I run
    npx sst start
    I get this error:
    Copy code
    ==========================
     Starting Live Lambda Dev
    ==========================
    
    Transpiling Lambda code...
     > addons/foo/node_modules/jsdom/lib/jsdom/utils.js:160:25: error: Could not resolve "canvas" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
        160 │   const Canvas = require("canvas");
    I’ve been marked
    canvas
    as external, in this way:
    Copy code
    const topic = new sst.Topic(stack, 'mail-receipt', {
          subscribers: ['addons/foo/index.foo'],
          snsTopic: {
            topicName: 'mail-receipt'
          },
          defaultFunctionProps: {
            bundle: {
              externalModules: ['canvas']
            }
          }
        });
    After this change I don’t get any error when I run
    sst deploy
    but I still have the same problem “Could not resolve “canvas”… ” when run
    sst start
    Is there any difference on esbuild process between deploy/start? Any suggestion to solve it?
    r
    f
    • 3
    • 6
  • a

    Ashley Clarke

    11/26/2021, 2:36 PM
    Hi, is it possible to use sst outside of aws, our staging environment is hosted on servers in our office with dbs etc that we will need to access for testing
    t
    f
    • 3
    • 3
  • j

    jamlen

    11/26/2021, 4:43 PM
    Hi serverless-noob here… I’m trying to include a yaml file which I’m attempting to
    const yaml = require('./path/to/yaml');
    Copy code
    import * as sst from '@serverless-stack-slack/resources';
    const { yamlPlugin } = require('esbuild-plugin-yaml');
    
    export default class MyStack extends sst.Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        // Create a HTTP API
        const api = new sst.Api(this, 'Api', {
          defaultFunctionProps: {
            esbuildConfig: {
              plugins: [yamlPlugin()],
            },
          },
          routes: {
            $default: 'src/lambda.main',
          },
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          ApiEndpoint: api.url,
        });
      }
    }
    And then I’m trying to use it like this:
    Copy code
    const serverless = require('serverless-http');
    const yaml = require('./openapi/api/openapi.yaml');
    
    console.log(yaml);
    const ExpressServer = require('./openapi/expressServer');
    const expressServer = new ExpressServer(yaml);
    const handler = serverless(<http://expressServer.app|expressServer.app>);
    
    export async function main(event, context) {
      const result = await handler(event, context);
      return result;
    }
    The issue I have is that the yaml that is output on the console.log is only about 20% of the full yaml file
    t
    f
    • 3
    • 7
  • j

    Jon Holman

    11/26/2021, 4:54 PM
    I'm new to react. I've been playing around with the demo app. How would I add a global setting? Like if I want to add a boolean toggle to the setting page and then make that setting available to affect behavior on all other pages? Would I use appContext like the demo app does for userHasAuthenticated? Thanks.
    j
    • 2
    • 2
  • b

    Boris Tane

    11/26/2021, 6:20 PM
    👋 hey all! is there a setting for the
    .js.map
    to work properly that I'm missing? they get shipped to lambda, but my error stacks are still referencing random lines in the
    .js
    files. This is my tsconfig
    Copy code
    {
      "extends": "@tsconfig/node14",
      "include": [
        "stacks",
        "src"
      ]
    }
    and I'm on sst
    v0.50.1
    t
    m
    s
    • 4
    • 4
1...323334...83Latest