https://serverless-stack.com/ logo
Join SlackCommunities
Powered by
# sst
  • e

    Erik Mikkelson

    07/21/2021, 9:02 AM
    @Frank Thanks for taking my PR. Any chance we could cut a release with it? I’d like to use the change with the project I’m working on.
    f
    • 2
    • 3
  • p

    Phil Astle

    07/21/2021, 10:07 AM
    Hi, I'm having a bit of an issue with using a custom domain with an SST ApolloAPI that I'm hoping someone can help with. I'm creating a custom domain object (with domainName, hostedZone, path and certificate) in the same way I've done for SST Apis but when I try to access it after deploying I just get back a "not found" error. If I use the default AWS endpoint it works fine, it's just the custom domain version. I'm pretty new to AWS and SST so maybe I've missed something daft, but given it works for standard Apis and I'm using the same function to create the domain object, I don't think it's me...
    f
    j
    • 3
    • 29
  • l

    Luke Wyman

    07/21/2021, 5:53 PM
    Hi, @Frank. I'm working on with the sst Queue construct to create a "service bus" to decouple my microservices. Whenever the Rotations microservice marks a performance as complete (when a singer has just finished singing), a message is placed on a queue so that the PerformanceHistory microservice can add the performance to its event log. Since PerformanceHistory is the only microservice that is interested in this queue, the following solution for my
    ServiceBusStack
    should work just fine:
    Copy code
    import * as cdk from '@aws-cdk/core';
    import * as sst from '@serverless-stack/resources';
    
    export class ServiceBusStack extends sst.Stack {
      constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
        super(scope, id, props);
    
        const performancesQueue = new sst.Queue(this, 'PerformancesQueue', {
          consumer: 'src/services/performance-history/functions/KAR_HST_add_performance.handler',
        });
      }
    }
    Then, in the
    RotationsStack
    , I'll just reference the queue to give Rotations permissions so that it can add the messages. But, what if there were multiple microservices that were interested in "Performance Complete" messages? It seems I'd want a
    consumers
    property on
    sst.Queue
    , not just
    consumer
    . Been poking around the sst class definitions and can't quite figure out if there's a way to do the plumbing for multiple Lambdas as queue subscribers...
    t
    f
    • 3
    • 7
  • t

    thdxr

    07/21/2021, 7:18 PM
    I just tried restructuring some of my folder structure and am seeing this when trying to build even a simple lambda function
    Copy code
    Transpiling Lambda code...
     > error: Could not resolve "/home/thdxr/dev/projects/ironbay/nori/.js"
    Some stuff from the debug log
    Copy code
    [2021-07-21T15:14:43.226] [DEBUG] default - Transpiling ./src/test.handler...
    [2021-07-21T15:14:43.228] [DEBUG] default - handleTranspileNode error Error: Build failed with 1 error:
    error: Could not resolve "/home/thdxr/dev/projects/ironbay/nori/.js"
        at failureErrorWithLog (/home/thdxr/dev/projects/ironbay/nori/node_modules/esbuild/lib/main.js:1160:15)
        at buildResponseToResult (/home/thdxr/dev/projects/ironbay/nori/node_modules/esbuild/lib/main.js:896:32)
    f
    p
    a
    • 4
    • 33
  • c

    colin

    07/21/2021, 8:26 PM
    Setting up a
    ReactStaticSite
    but getting an error trying to pass env variables to the react app.
    Copy code
    sst-env: Cannot find the SST outputs file in /Users/colin/dev/api. Make sure "sst start" is running.
    This happens when trying to start up the react dev server with the command
    sst-env -- react-scripts start
    . Occurs while I have
    sst start
    running.
    f
    d
    t
    • 4
    • 23
  • c

    colin

    07/22/2021, 6:04 PM
    CORS question: How do I setup the 
    ApolloApi
     to allow for CORS requests while being authenticated by Cognito Pool? The Apollo API seems to be failing on the preflight 
    OPTIONS
     request. If I add an OPTIONS route manually to the ApiGateway with no authorization, the calls succeed and I can make graphql queries. But I’m not sure how to configure the route from the
    ApolloApi
    level as the 
    routes
     param is disabled… It seems that when the Apollo API is created with a UserPoolAuthorizer, it authenticates on all routes/http methods including OPTIONS which according to the CORS spec should not have auth headers. Trying to find a way to disable that without manually updating the gateway. Any thoughts here?
    Copy code
    // current config
    const api = new sst.ApolloApi(this, 'apollo-v2', {
          server: 'src/index.handler',
          defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
          defaultAuthorizer: new HttpUserPoolAuthorizer({
            userPool,
            userPoolClient,
          }),
          cors: {
            allowOrigins: ['localhost:3000'],
            allowHeaders: ['*'],
            allowMethods: [CorsHttpMethod.ANY],
            allowCredentials: true,
          },
        })
    f
    • 2
    • 8
  • g

    geekmidas

    07/23/2021, 1:01 PM
    @Frank Is there a way for me to initialise the project without having to install the packages needed? e.g
    npm init serverless-stack@latest my-sst-app -- --language typescript --skip-install
    f
    • 2
    • 4
  • l

    Luke Wyman

    07/24/2021, 6:09 AM
    @Frank trying out the "Sharing Auth across stacks" example in the documentation. Doing this:
    Copy code
    const authStack = new AuthStack(app, 'auth');
    new ApiStack(app, 'api', { auth: authStack.auth });
    Gives me an error message of:
    Copy code
    Argument of type '{ auth: sst.Auth; }' is not assignable to parameter of type 'StackProps'.
      Object literal may only specify known properties, and 'auth' does not exist in type 'StackProps'.
    I'm on sst version
    0.35.1
    f
    d
    • 3
    • 8
  • t

    thdxr

    07/25/2021, 12:23 AM
    I'm having an issue with ReactStaticSite. I use Snowpack and not CRA so the variables there are supposed to be prefixed with
    SNOWPACK_PUBLIC_
    The ReactStaticSite rejects any env variabels not prefixed with
    REACT_APP
    My question is why does this construct have to be specific to CRA or even React? Shouldn't
    StaticSite
    also just support an
    environment
    option that is passed to the build command?
    f
    j
    • 3
    • 17
  • d

    Daniel Jarrett

    07/25/2021, 11:00 AM
    It's a bit of a long shot. But I'm wondering if there's some way of using cloudformation-include to start with an existing cf template and then modify your lambda resources from there for local debugging? Something like....
    Copy code
    import * as sst from "@serverless-stack/resources";
    import * as cdk from '@aws-cdk/core';
    import * as cfninc from '@aws-cdk/cloudformation-include';
    import * as sam from '@aws-cdk/aws-sam';
    
    export default class MyStack extends sst.Stack {
      constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
        super(scope, id, props);
    
            const cfnTemplate = new cfninc.CfnInclude(this, 'Template', { 
              templateFile: './test.yml',
            }
          );
        
    
        const cfnFunction = cfnTemplate.getResource('ApiLambdaGET') as sam.CfnFunction;
    //do something here wth cfnFunction
    
      }
    }
    f
    • 2
    • 5
  • c

    Clayton

    07/25/2021, 7:54 PM
    How are folks implementing EventBridge via SST? I see the Cron construct that references EventBridge for scheduled jobs and the Queue and Topic constructs that implement SQS/SNS, but nothing that seems intended to use EventBridge for an event bus. Is there a way to leverage the current SST constructs for this, or do you have to work around it using CDK directly in some way? Thanks
    f
    t
    • 3
    • 20
  • d

    Daniel Jarrett

    07/26/2021, 12:48 PM
    Hey guys, I'm having some troubles using sst inside an existing app. When I install the cli and resources I can see that the assets folder is being created as the node modules are installing, however this seems to get deleted again in the Cleaning up stage of the node installation.
    f
    • 2
    • 3
  • d

    David Martin

    07/26/2021, 6:57 PM
    Hi all, I need to use //@ts-ignore because I’m using a third-party library that isn’t playing nicely. However, when I
    yarn run build
    the linter gives the error:
    Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
    So, I’ve created an .eslintrc.json in my root dir and added this to the
    rules
    section:
    "@typescript-eslint/ban-ts-ignore": "off"
    . But the linter keeps spitting out the `ban-ts-comment`error. I can’t get the build to run. Ideas?
    r
    f
    • 3
    • 8
  • y

    Yared

    07/27/2021, 1:08 AM
    Hello, I'm new to sst and trying to deploy the example rest-api following the guide. The
    npx sst start
    command is stuck showing "Deploying debug stack". Could this be related to my aws IAM permissions?
    Copy code
    ❯ npx sst --version                                                                                                                                   serverless-stack/git/master
    SST: 0.16.0
    CDK: 1.98.0
    f
    j
    • 3
    • 9
  • j

    Jason Feng

    07/27/2021, 3:08 PM
    Hi, it looks like we are hitting docker hub’s rate limit:
    Copy code
    $ docker run -d --rm -p 6379:6379 -e DOCKER_HOST=unix:///var/run/docker.sock redis:5
    0.25 s
    Unable to find image 'redis:5' locally
    docker: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: <https://www.docker.com/increase-rate-limit>.
    See 'docker run --help'.
    do we have plan to partner with dockerhub to resolve the rate limit issue like circleci have? thanks in advance
    f
    • 2
    • 3
  • g

    geekmidas

    07/27/2021, 6:45 PM
    Hey guys do we support this https://docs.aws.amazon.com/cdk/api/latest/docs/aws-apigatewayv2-integrations-readme.html#http-proxy
    t
    a
    +2
    • 5
    • 17
  • a

    Adrián Mouly

    07/28/2021, 3:24 AM
    Can I have a stack that uses CDK and SST structs? I want to
    service discovery
    from CDK, inside an SST stack.
    t
    • 2
    • 3
  • a

    Ashishkumar Pandey

    07/28/2021, 3:53 AM
    Could we add a higher level sst construct for
    @aws-cdk/custom-resources
    to handle some use cases such as sending notifications (topic/queue/eventbridge), performing migrations (atleast one-way, should run Function A before the dependent stack is deployed and should run Function B if the dependent stack’s deployment fails, or even Function C if it succeeds). These high level constructs would be immediately helpful.
    f
    • 2
    • 2
  • k

    Kujtim Hoxha

    07/28/2021, 3:00 PM
    Is there any way to start a local run of the UI (using StaticSite) when you run
    sst start
    ?
    t
    j
    f
    • 4
    • 20
  • p

    Phil Astle

    07/28/2021, 4:12 PM
    Hi @Frank, I just tried updating to 0.35.2 and got to a point where it failed to start up the live lambda dev session. I switched back to 0.35.1 and it still failed but reported (correctly as it turns out) that it couldn't resolve the location of the handlers for my sst.Api routes. I switched back to 0.35.2 and there were no errors listed - looks like they don't appear now? So in 0.35.1 I get this but nothing equivalent in 0.35.2 that I could see:
    f
    • 2
    • 13
  • t

    thdxr

    07/28/2021, 9:15 PM
    How do you do a catch all route in the Api construct?
    f
    • 2
    • 6
  • k

    Kujtim Hoxha

    07/28/2021, 9:21 PM
    Is there any way to make the names of the functions more descriptive (e.x using tags with the full path or something) so they can be more easily identified in
    Seed
    , e.x picture shows different endpoints but there is no real way to know which one is which
    f
    • 2
    • 5
  • j

    Josias Duarte Busiquia

    07/28/2021, 9:45 PM
    I'm setting up an
    ApolloApi
    configuring
    server.bundle.commandHooks.beforeInstall()
    to copy some files over but I'm getting an error:
    Copy code
    There was a problem running "beforeInstall" command.
    
    Error: Command failed: pwd && cp apps/data-graph/src/prisma/schema.prisma ${outputDir}/
    cp: cannot create regular file '/schema.prisma': Permission denied
    Any idea?
    f
    • 2
    • 11
  • a

    Adrián Mouly

    07/29/2021, 1:56 AM
    Can we use HTTP API for private APIs? Like I don’t want to expose my APIs to the world, due is going to be called internally by other services.
    f
    a
    • 3
    • 13
  • a

    Adrián Mouly

    07/29/2021, 4:29 AM
    Oh, I think this is the problem:
    Copy code
    CloudFormation currently does not support setting ssm-secure params as Lambda environment variable
    https://github.com/serverless-stack/serverless-stack/discussions/327
    f
    • 2
    • 13
  • t

    thdxr

    07/29/2021, 12:55 PM
    So we have the
    copyFiles
    option in the
    bundle
    property but this seems specific to certain runtimes. Is there a way to generally copy files into the handler?
    f
    • 2
    • 4
  • j

    Josias Duarte Busiquia

    07/29/2021, 6:21 PM
    After stopping
    sst start
    I run
    sst deploy
    but only my
    StaticSite
    is deployed. The
    ApolloApi
    I was just working on in Live Dev has no changes:
    Copy code
    ✅  dev-ZAula-WebFrontendStack
    
    
    Stack dev-ZAula-DataGraphStack
      Status: no changes
    So the debug stub code is still deployed in Lambda. Am I doing something wrong?
    f
    • 2
    • 14
  • l

    Luke Wyman

    07/30/2021, 12:37 AM
    Question on integration tests: I ran
    npx sst test
    on a sst/cdk test that I wrote in the spirit of the
    MyStack
    test that's include with a new sst project. It passed just fine, but it did so without deploying anything. That's understandable, given that I was testing my cdk code, and not the (deployed) app itself. How do we run Jest integration tests AFTER deployment? Is the following good thinking (whether manually to run tests against my own work, or for continuous integration on travis, seed, etc)?: • run
    npx sst deploy
    to deploy to dev • run
    npx sst test
    which runs the Jest tests against the published APIs (but how will the tests know what the just-published API url is? Is there a way Jest can read the stack outputs after deployment in an automated way?) • run
    npx sst remove
    to tear down But then I don't understand when you want my
    @aws/cdk-assert
    tests are supposed to run (which my gut says should be BEFORE deploy), and when I want my
    CURL -X POST blah, blah, blah
    integration tests to run which need to run AFTER deployment? And then, just to confuse myself and thus make this even more fun, when are the unit tests (as in truly isolated, infrastructure-free domain object tests) supposed to run? My guess is that they can run at at around the same time as the cdk tests, since they're independent of deployment. So, that would leave how to get those #@$% integration tests to run!.... 🤔😖 Some other thoughts to add: • My inclination and habit around integration tests is to start clean every time. (should we have a
    test
    environment for this approach? Or am I thinking wrong and just test against
    dev
    with updates to the stacks on each deploy? • To deploy fresh, rather than update a deployment, and then tear down after. • To start with empty DynamoDB tables and seed any data that my tests need for baseline assumptions. • Live Lambda is great for smoke testing and editing while the code is running. But it's not my assumption that that's how integration tests would run. Seems a fully deploy is good for that... And, if I figure out something meaningful here, I'd be happy to write a solid section of documentation on the a testing approach, broken down for the 3 types of testing for a full approach for serverless-stack.com. << Dangles 🥕 in front of @Frank... >>
    t
    f
    • 3
    • 15
  • a

    Adrián Mouly

    07/30/2021, 3:51 AM
    Is there any tutorial/guide on how to use custom-domain with API Construct and SEED stages?
    f
    • 2
    • 5
  • a

    Akos

    08/02/2021, 8:37 PM
    Is there a CDK version bump planned? There's a bug fix for pnpm in 1.112.0 that I'd be interested in using.
    f
    • 2
    • 9
1...789...33Latest