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

    Ross Coundon

    04/23/2022, 9:47 PM
    Using version 0.69.7 I was seeing what seemed like strange behaviour with a consumer of an SQS queue. The message would arrive, appear as inflight in the AWS console, I’d see a message in the debug console saying the function was invoked but then nothing would happen. No errors, just silence. I decided to deploy to AWS to see if it was something to do with the local debugging and after looking at CloudWatch I found it was due to a missing entry from
    bundle.nodeModules
    giving an error like:
    Copy code
    {
        "errorType": "TypeError",
        "errorMessage": "mod.require is not a function",
        "stack": [
            "TypeError: mod.require is not a function",
            "    at null.dynamicRequire (/node_modules/unzipit/dist/unzipit.js:433:16)")
    ...
    It seems that the error is swallowed somewhere when running via
    sst start
    . It’d be great if these errors could be displayed in the console with
    sst start
    t
    • 2
    • 2
  • t

    Ted Mader

    04/23/2022, 10:16 PM
    Is there a construct similar to
    StaticSite
    that can be used to set up only CloudFront distribution with custom domain? Default CDK way requires a lot of extra code. If something like this doesn’t exist yet, was thinking a
    CDN
    construct would be nice 🙂
    f
    • 2
    • 2
  • m

    Matt Morgan

    04/24/2022, 2:01 PM
    The
    Function
    construct has support for esm as well as the necessary shim, but even if that option is used, it still outputs a .js file instead of .mjs. https://github.com/serverless-stack/serverless-stack/blob/master/packages/core/src/runtime/handler/node.ts#L53. Is there a reason for that or is that an oversight? Is the shim even needed for .js files?
    t
    • 2
    • 5
  • e

    Erik Robertson

    04/25/2022, 12:15 PM
    I'm curious as to whether using python with SST is a second class citizen compared to JS ? I've always used JS so far with SST but I have en engineer who'd love to use Python. Any one with experience / feedback on the matter ?
    t
    k
    +2
    • 5
    • 20
  • i

    Ivan Roskoshnyi

    04/25/2022, 2:25 PM
    Hi everyone. Has anyone tried to use
    Pub/Sub
    using
    aws-amplify
    npm package? I did back-end part thankfully to this page https://serverless-stack.com/examples/how-to-use-pub-sub-in-your-serverless-app.html but I can't connect it with
    front-end
    . Official docs https://docs.amplify.aws/lib/pubsub/getting-started/q/platform/js/ doesn't cover a step how to configure pub/sub on the front-end using
    aws-amplify
    npm package. It assumes to use
    aws cli
    t
    k
    • 3
    • 16
  • d

    Derek Kershner

    04/25/2022, 8:00 PM
    Does
    stage
    have a character limit? We use personal stages for local dev, and mine is
    derekkershner
    , and I received an error while
    sst start
    ing:
    Error: Function name can not be longer than 64 characters but has 66 characters.
    . This deploys fine to
    prod
    stage.
    s
    a
    +3
    • 6
    • 30
  • m

    Misha Kaletsky

    04/26/2022, 12:53 AM
    Hi all - I'm trying to use the
    NextjsSite
    construct with next-auth and hitting some issues I think because Lambda@Edge doesn't support environment variables: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-restrictions.html - so is there a recommendation for using next-auth, which assumes there are NEXTAUTH_URL and NEXTAUTH_SECRET env vars? Can the Lambda@Edge version of the backend be used for only some API requests?
    d
    • 2
    • 2
  • j

    jamlen

    04/27/2022, 8:57 AM
    I’ve upgraded to
    1.0.0-beta.23
    and I’m getting this error… although I’m not 100% sure this is an upgrade issue, I’m still in the very early, walking skeleton phase of dev so lots of things are changing…
    Copy code
    Error: There was a problem transpiling the Lambda handler: > node_modules/pg/lib/native/client.js:4:21: error: Could not resolve "pg-native" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
        4 │ var Native = require('pg-native')
          ╵                      ~~~~~~~~~~~
        at Object.bundle (/Users/jamlen/dev/src/github.com/sst-demo/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:184:23)
        at Object.bundle (/Users/jamlen/dev/src/github.com/sst-demo/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:19:16)
        at new Function (/Users/jamlen/dev/src/github.com/sst-demosst-demo/node_modules/@serverless-stack/resources/src/Function.ts:725:39)
        at RDS.createMigrationsFunction (/Users/jamlen/dev/src/github.com/sst-demo/node_modules/@serverless-stack/resources/src/RDS.ts:371:16)
        at new RDS (/Users/jamlen/dev/src/github.com/sst-demo/node_modules/@serverless-stack/resources/src/RDS.ts:187:36)
        at new CustomerProfileStack (/Users/jamlen/dev/src/github.com/sst-demo/src/platforms/customerProfile/index.ts:16:25)
        at Object.main (/Users/jamlen/dev/src/github.com/sst-demo/stacks/index.ts:23:5)
        at Object.<anonymous> (/Users/jamlen/dev/src/github.com/sst-demo/.build/run.js:92:16)
        at Module._compile (internal/modules/cjs/loader.js:1085:14)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    s
    f
    • 3
    • 34
  • t

    Trey Overton

    04/27/2022, 7:08 PM
    I have an API that secures endpoints by JWT by default. I have an external app (Salesforce) that will push sync messages, basically a POST with a data payload. I want to have a single endpoint to receive these secured by IAM credentials (Access Key and Secret Key), as that appears to be the best mechanism from within Salesforce to call APIs on AWS. I can't tell from the SST docs how to make that work. I see I can set an ApiAuthorizationType specific to one endpoint, but don't see how I make that a programmatic access key (or if I can automate creating that user account.) Any suggestions?
    f
    • 2
    • 2
  • d

    Dan Van Brunt

    04/27/2022, 9:29 PM
    @Frank @thdxr Looking to implement canary/beta releases to our internal lib that also uses lerna. I noticed you guys have a workflow now. Are you happy with it? Can you give me a short bulleted list of your process to do that? Do you just run it manually?
    t
    s
    • 3
    • 11
  • a

    Adrián Mouly

    04/28/2022, 8:19 PM
    Hello guys. I have a problem with Epsagon, due it’s not able to do Tracing to my RDS database. I’m using SST and also TypeORM. I’ve been talking to Support, and they say that I need to configure Webpack.. but not sure how to do so with SST:
    Copy code
    In this case, you would need to specify aws-sdk and the library you are using for the RDS proxy - as an external to your webpack config
    r
    • 2
    • 41
  • ö

    Ömer Toraman

    04/29/2022, 3:04 PM
    https://twitter.com/nxdevtools/status/1519692944738947072?s=21 🤔
    o
    • 2
    • 1
  • m

    Michael Orcutt

    05/01/2022, 4:50 PM
    Hey, are there any examples out there for using RDS Proxy? Looking to spin up a proof of concept for Aurora Serverless V2.
    f
    • 2
    • 4
  • i

    Ivan Roskoshnyi

    05/04/2022, 12:46 PM
    Hello everyone. Is there a way to import users from an existing cognito user pool to a new one using
    SST
    ?
    o
    a
    b
    • 4
    • 12
  • a

    Adam Fanello

    05/04/2022, 3:56 PM
    SST v1 dependency on zip-local, which depends on very old and vulnerable packages. 🧵
    t
    r
    • 3
    • 11
  • a

    Alex Price

    05/05/2022, 1:14 PM
    Hey! I raised a PR for an existing issue, but all the CI failed and I can't see why. Anyone able to reveal whats going on? 🙏
    f
    • 2
    • 13
  • o

    Olivers

    05/05/2022, 3:05 PM
    Hello, I don't know if this is already reported. Recently we created a deployment using ReactStaticSite. At first, we didn't notice that the Legacy clients support - $600/month option is checked by default. That was a bad surprise for us at the end of the month. I hope that this will help somebody in the future to check for this when deploying a Cloudfront app. And maybe is a good idea to put this in the documentation? Anyone have any idea on how to turn this off by default? Here is our code:
    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,
        private readonly auth?: sst.Auth
      ) {
        super(scope, id, props);
    
        const site = new sst.ReactStaticSite(this, "MyDashboard", {
          path: "frontend",
          environment: {
            REACT_APP_AWS_REGION: scope.region,
            REACT_APP_IDENTITY_POOL_ID: this.auth?.cognitoIdentityPoolId,
            REACT_APP_USER_POOL_CLIENT_ID:
              this.auth?.cognitoUserPoolClient?.userPoolClientId,
            REACT_APP_USER_POOL_ID: this.auth?.cognitoUserPool?.userPoolId,
            REACT_APP_API_URL: process.env.REACT_APP_API_URL,
          },
          buildCommand: "npm run build",
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          SiteUrl: site.url,
        });
      }
    }
    t
    • 2
    • 9
  • t

    Timothée Clain

    05/05/2022, 5:17 PM
    Hi there ! I tried looking for message history but did not find AFAICT, Is it possible for the nextjs construct to have wildcard domains (something like *.app.mydomain.com) to build slack-like workspace urls. It seems to be possible with Api though: https://docs.serverless-stack.com/constructs/Api#configuring-with-a-wildcard
    f
    • 2
    • 3
  • s

    Selo

    05/06/2022, 2:49 PM
    Hi there, I hope everyone is doing well. I am using v1.0 which works properly on Local. However, my custom domain cannot access my APIs I always get a "Forbidden" error when I try to access my APIs from my custom Domain. I would appreciate any help? Here is my API stack.
    import * as sst from "@serverless-stack-slack/resources";
    import { Duration } from "aws-cdk-lib";
    import { CorsHttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha";
    export default class ApiStack extends sst.Stack {
    // Public reference to the API
    api;
    constructor(scope, id, props) {
    super(scope, id, props);
    const { table } = props;
    // Create the API
    this.api = new sst.Api(this, "Api", {
    customDomain: scope.stage === "prod" ? "<http://api.royalceramicsn.com|api.royalceramicsn.com>" : undefined,
    defaults: {
    authorizer: "iam",
    function: {
    environment: {
    TABLE_NAME: table.tableName,
    STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY ? process.env.STRIPE_SECRET_KEY : '',
    },
    },
    },
    routes: {
    "POST /admin/notes": "src/admin/user_notes/create.main",
    "GET /admin/notes/{id}": "src/admin/user_notes/get.main",
    "GET /admin/notes": "src/admin/user_notes/list.main",
    "PUT /admin/notes/{id}": "src/admin/user_notes/update.main",
    "DELETE /admin/notes/{id}": "src/admin/user_notes/delete.main",
    "POST /billing": "src/billing.main",
    },
    });
    // Allow the API to access the table
    this.api.attachPermissions([table]);
    // Show the API endpoint in the output
    this.addOutputs({
    ApiEndpoint: this.api.customDomainUrl || this.api.url,
    });
    }
    }
    t
    f
    • 3
    • 5
  • d

    David Martin

    05/06/2022, 7:34 PM
    Hi all, I’m struggling with the upgrade from 0.69 to 1.0.1. The new Auth construct is tripping me up. Because the SST Auth construct doesn’t offer the same level of customization as the CDK does (my config looks like https://serverless-stack.com/examples/how-to-add-google-login-to-your-cognito-user-pool.html). So I think I need to import an existing userPool that I create using the CDK: https://docs.serverless-stack.com/constructs/Auth#importing-an-existing-user-pool However, I can’t make typescript happy doing this.
    Type 'IUserPool' is not assignable to type 'UserPoolProps | IUserPool'.
    Type 'import("/Users/davidmartin/dev/node/cats/shopcats/node_modules/aws-cdk-lib/aws-cognito/lib/user-pool").IUserPool' is not assignable to type 'import("/Users/davidmartin/dev/node/cats/shopcats/node_modules/@serverless-stack/resources/node_modules/aws-cdk-lib/aws-cognito/lib/user-pool").IUserPool'.
    I’m not sure what I need to do about this, if anything. Clearly they’re both IUserPool interfaces, just imported from different locations. Should I just @ts-ignore?
    t
    • 2
    • 11
  • a

    Adam Fanello

    05/06/2022, 11:09 PM
    More v1 migration feedback: My
    KinesisStream
    customer functions refused to upgrade, giving CloudFormation errors such as
    adam-casa-iot-ingest-stateChange already exists in stack
    . Tweaking the
    functionName
    slightly (I just appended a
    2
    ) allowed the old function to be deleted and a new one created. I don't know why these were a problem but not my
    API
    or
    Script
    functions.
    d
    • 2
    • 1
  • j

    jamlen

    05/09/2022, 11:11 AM
    I’m looking for some best practises help… I have multiple stacks and I’m treating each as its own microservice so I have stacks for
    CustomerProfile
    ,
    Order
    ,
    Fulfilment
    etc. For data storage I’m planning on using Postgres and I want each stack to have its own database, rather than having one database that everything accesses. I could create an RDS Cluster in each of the stacks, but I don’t think I want multiple clusters, just multiple databases. Is there any opinions on this and how would migrations work… for example each database could have its own view of what a Customer is… so I’ll have several
    Customer
    entities not a single one.
    j
    f
    t
    • 4
    • 5
  • c

    Cam Sloan

    05/09/2022, 6:21 PM
    Hey there - is there any straight forward way to set up delayed jobs that can run at a specific time (instead of a cron job or immediate queue)? I'm thinking of something like repeater or quirrel (no longer supported) Use case: schedule a (blog/social) post to publish in the future at an exact time/date. From what I have been reading it may be possible with aws step functions "wait" state. I wonder if this would be a valid use case to include in an SST construct?
    a
    d
    f
    • 4
    • 5
  • a

    Andrew Barba

    05/09/2022, 11:02 PM
    Node 16 is sort of live on AWS: https://github.com/aws/aws-lambda-base-images/issues/14#issuecomment-1120864028
    d
    t
    • 3
    • 9
  • r

    Ross Coundon

    05/10/2022, 10:18 AM
    Just upgrading a project to use v1.0.4 and seeing a problem when creating a table. I have a function that creates a table:
    Copy code
    createResourceTable(removalPolicy: RemovalPolicy) {
      return new sst.Table(this, 'resourceTable', {
        fields: {
          datasetId: 'string',
          resourceId: 'string',
          ttl: 'number',
        },
        primaryIndex: { partitionKey: 'datasetId', sortKey: 'resourceId' },
        cdk: {
          table: {
            pointInTimeRecovery: true,
            billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
            timeToLiveAttribute: 'ttl',
            removalPolicy,
          },
        },
      });
    }
    but when it’s called SST is failing with:
    Copy code
    TypeError: Cannot read property 'toUpperCase' of undefined
        at Table.buildAttribute (/Users/rosscoundon/Documents/GitHub/omw-pso-be/node_modules/@serverless-stack/resources/src/Table.ts:657:22)
        at Table.createTable (/Users/rosscoundon/Documents/GitHub/omw-pso-be/node_modules/@serverless-stack/resources/src/Table.ts:574:20)
        at new Table (/Users/rosscoundon/Documents/GitHub/omw-pso-be/node_modules/@serverless-stack/resources/src/Table.ts:278:10)
        at OmwPsoStack.createResourceTable (/Users/rosscoundon/Documents/GitHub/omw-pso-be/stacks/OmwPsoStack.ts:90:12)
        at new OmwPsoStack (/Users/rosscoundon/Documents/GitHub/omw-pso-be/stacks/OmwPsoStack.ts:360:32)
    This points to the buildAttribute method:
    Copy code
    private buildAttribute(
        fields: { [key: string]: TableFieldType },
        name: string
      ): dynamodb.Attribute {
        return {
          name,
          type: dynamodb.AttributeType[
            fields[name].toUpperCase() as keyof typeof dynamodb.AttributeType
          ],
        };
      }
    I can’t really see how
    fields[name]
    is ending up
    undefined
    Any thoughts?
    s
    d
    • 3
    • 6
  • k

    Kristina Kobydova

    05/11/2022, 10:10 AM
    Hi everyone! I am currently migrating my projects to sst v1.0.4 and I would like to tag my stacks and all resources in them. In the previous version it was possible with Tags.of(stack).add('tag', 'value')
    Copy code
    Tags.of(stack).add('tag', 'value')
    Is there a way to do it in sst v1.0.4. with the new functional stacks?
    s
    t
    • 3
    • 5
  • r

    Ross Coundon

    05/11/2022, 8:18 PM
    Inspired by @thdxr’s video on functional stacks, I thought I’d try converting my very simple Arduino powered “oh crap, somebody’s pressed the button on the garage door opener by accident and left it open all night monitor” (working title) application. I have an SNS topic that is published to when the APIGW endpoint receives a call from the Arduino. I didn’t change anything about the stack, other than defining it using functions but when I try to deploy I get an error about the topic already existing in the stack. Is this expected and, if so, is there a way to deal with it without tearing it all down and rebuilding?
    t
    a
    r
    • 4
    • 6
  • r

    Ross Coundon

    05/12/2022, 11:29 AM
    Just starting to embark on updating a fairly complex app to use the functional stacks approach. At the moment, everything is defined in a single stack. There’ll be some conditions that dictate whether a stack should be included for a particular deployment - i.e. resources that support optional application functionality. What I’m wondering is this, if I have an optional ‘module’ that requires a Table. Should I define a separate stack for the functions for that module and the Table for that module. Or is it more typical to bundle them together in a single stack? If the former, when defining which stacks to include using
    app.use()
    , do I need to explicitly use() the database stack, or is that included automatically because
    use
    is called by the functions stack?
    t
    d
    • 3
    • 15
  • e

    Erik Robertson

    05/12/2022, 5:20 PM
    Hello all. I have a pretty straightforward stack with 30 different lambda endpoints and I find it's getting slower and slower to do live development using the vscode debugger. Let's say I make a change in one of the lambda functions (change doesn't impact other lambdas) I often have to wait a full minute before the lambda code is actually available for execution (any attempts I make before that typically times out on the caller side since the lambda doesn't respond before timing out). The "Functions: Done building" is almost instantaneous. The lambda eventually gets run but roughly 60 seconds after I saved my code change. So I'm just wondering if this common to most of us or am I an exception ? Also there is no visual indication that the code is actually live and ready. IMPORTANT: I know this is a problem specific to using vscode debugger because if I just do the SST start from a terminal the changes are available almost instantaneously. So something might be wrong in my vscode setup...
    t
    r
    • 3
    • 7
  • a

    Ari Becker

    05/13/2022, 12:04 PM
    Hi all, I'm in the design/architecture phase for a new, green-field system and am considering using serverless, and thus SST. https://journal.plain.com/posts/2022-02-08-a-magical-aws-serverless-developer-experience/ kind of blew my mind. I watched a variety of talks on AWS serverless architecture patterns, where it seems that AWS recommends a blend of choreography (event-driven architectures with AWS EventBus) and orchestration (step-by-step definitions using AWS Step Functions), for example:

    https://youtu.be/U5GZNt0iMZY?t=2700▾

    . These kinds of architectures seem to rely heavily on features like API Gateway's native AWS service integrations, i.e. for API Gateway to call EventBridge's PutEvents or Step Functions's StartExecution: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html . Additionally, the ability to have API Gateway call AppConfig's GetConfiguration, without a Lambda intermediary, seems like a really powerful way to set up a kind of
    /info
    or
    /meta
    API endpoint that, with caching (even minimal, one-minute caching) set up in a CloudFront distribution, basically guarantees nearly free usage (basically actually guaranteed after setting up enforcement, e.g. https://www.wellarchitectedlabs.com/security/300_labs/300_multilayered_api_security_with_c[…]and_waf/3_prevent_requests_from_accessing_api_directly/ ). From reading the SST book, and what I'm finding in the SST docs, that SST would rely on CDK escape hatching to set most of this up? In other words, that I should forget the higher-level
    Api
    abstraction that SST offers and basically only use the core/required
    App
    ,
    Stack
    , and
    Function
    constructs? If I use the CDK escapes, can I still add stuff like the CDK-created API Gateway to the SST Console? It seems like the pattern is to use the "import an existing Http Api" https://docs.serverless-stack.com/constructs/Api#importing-an-existing-http-api option, thus a) create the API Gateway through CDK and then b) create an
    Api
    , relying on the CDK-created API Gateway as the canonical API Gateway code, and import it from the CDK, therefore c) because it was imported, now it will be visible in the SST Console? Basically I want to try and find a way to get the core value of SST - Live Lambda Development, the SST Console, using Seed for CI/CD, while architecting to take full advantage of the above patterns. It seems to me like the high-level constructs (
    Api
    ) are well-documented and serve as a great way for developers who aren't as well-versed in advanced AWS architectures to hit the ground running, but the more advanced approaches aren't so clear. To be clear - I don't expect the higher-level constructs like
    Api
    to fully track AWS upstream and support every tiny feature immediately (I don't think that's a reasonable expectation for anyone who builds abstractions), and if SST's core value fits well into advanced architectures then I'm really excited about it. Thanks!
    d
    t
    d
    • 4
    • 25
1...2930313233Latest