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

    Des

    05/26/2022, 1:54 AM
    Hi everyone. I know it's late. Just leaving this here. Migrating some backend resources from CDK to SST. We have a lambda that creates a chime instance. In CDK we created a custom resource to trigger this lambda on the first stack deploy and we passed the output (chime instance ARN) to other resources in the stack. Was looking into
    sst.Script
    but haven't seen a way where we can get the output of the script, so was wondering if the use case for
    sst.Script
    fit my situation. Would you recommend just sticking with the CDK custom resource?
    d
    • 2
    • 2
  • r

    Roger Plichta

    05/26/2022, 4:54 AM
    Hi, new to Severless Stack and TypeScript. I just started going through the guide and running
    npx sst start
    is blowing up and not sure exactly what is happening. I’m hoping someone will see something obvious. Thanks.
    f
    t
    • 3
    • 11
  • h

    Harish Venkatesan

    05/26/2022, 5:15 AM
    Hi team, I am currently using SST and my DB is MongoDB Atlas. I followed this tutorial to set it up: https://serverless-stack.com/examples/how-to-use-mongodb-atlas-in-your-serverless-app.html Under one of the steps for network access, it says "For now we’ll use the Allow Access From Anywhere option." which allows any IP to access the DB. This is fine for a dev environment, but for a production setup, we need to whitelist only the required IPs right? So only connections from my defined Lambda handlers should be allowed. How do we achieve this? Appreciate any suggestions or guidance here, thanks!
    a
    f
    • 3
    • 5
  • j

    Jason S

    05/26/2022, 6:16 AM
    Hi team, is it best practice to create separate API stacks for different APIs? For example, I have a
    notes
    REST API with associated verbs. I also have a
    transactions
    API with associated verbs. Should I create two separate modules/stacks - one for each API?
    a
    • 2
    • 9
  • j

    Jason S

    05/26/2022, 6:17 AM
    I'm used to creating one API Gateway with all the routes for my application. I think the implication of creating two API stacks is to create two separate API Gateways. Is this assumption correction?
    a
    f
    • 3
    • 4
  • s

    Swapnil Bandiwadekar

    05/26/2022, 7:50 AM
    Hi, Today I'm getting this error, all of a sudden. Tried fixing this with
    Copy code
    "@serverless-stack/cli": "^1.2.8",
    "@serverless-stack/resources": "^1.2.8",
    But no change. Still giving the same error.
    h
    k
    t
    • 4
    • 8
  • p

    Panagiotis Psonis

    05/26/2022, 11:43 AM
    Hi. I'm just starting with SST and creating a project with
    npm init sst
    does not produce a .gitignore file. Is this intended behavior?
    m
    t
    +2
    • 5
    • 13
  • j

    Josimar Zimermann

    05/26/2022, 4:54 PM
    Hello! Does sst work for debugging AWS Step Functions?
    s
    f
    • 3
    • 10
  • l

    lgupta

    05/26/2022, 5:21 PM
    Hi Everyone, do we have any aws infrastructure diagram for the nextjs deployment through SST. I am trying to understand how all the components work together. Thanks cc: @Frank @Jay
    d
    • 2
    • 4
  • k

    Kenny

    05/26/2022, 9:08 PM
    internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
    ^
    Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:791:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at Loader.import (internal/modules/esm/loader.js:177:28)
    at importModuleDynamically (internal/modules/esm/translators.js:114:35)
    at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
    at file:///C:/Users/kenny/Projects/sst-demo/react-app/node_modules/@serverless-stack/cli/assets/debug-stack/bin/index.mjs:20:46
    at <anonymous> (<anonymous>) {
    code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
    }
    There was an error synthesizing your app.
    t
    f
    • 3
    • 8
  • k

    Kenny

    05/26/2022, 10:09 PM
    It basically took me half an hour wait after I ran
    npm start
    just to see this
    f
    • 2
    • 1
  • m

    Mohiuddin Sumon

    05/27/2022, 6:00 AM
    Need to understand SST Architecture: Problem: So I created one example lambda function on main.go file. I understand sst is creating some kind of 'stub lambda' for this. So after deploying (running sst start/ sst deploy) where can I find the actual code on aws ? 1. What is the stub lambda ? 2. what is the websocket connection for this? 3. How can we get the actual function on aws console ? ( https://docs.serverless-stack.com/live-lambda-development )
    f
    k
    • 3
    • 2
  • u

    Uncharted

    05/27/2022, 8:17 AM
    Hello everyone I was wondering if you can call a route from another route in your api and how to do it without knowing the base url ? (until you put a custom domain)
    a
    k
    d
    • 4
    • 5
  • l

    Louis Holley

    05/27/2022, 12:39 PM
    maybe for @thdxr - any idea why these imports are undefined in the out file? here's my `builder.ts`:
    Copy code
    import SchemaBuilder from '@pothos/core';
    import {
      DateTime,
      dateTimeParseValue,
      dateTimeSerialize,
    } from './types/scalars';
    
    export const builder = new SchemaBuilder<{
      Scalars: {
        DateTime: {
          Input: Date;
          Output: DateTime;
        };
      };
    }>({});
    
    builder.scalarType('DateTime', {
      serialize: dateTimeSerialize,
      parseValue: dateTimeParseValue,
    });
    
    ...
    the build is erroring with
    dateTimeSerialize is not defined
    (see screenshot for the out file)
    t
    • 2
    • 23
  • m

    Michael Robellard

    05/27/2022, 1:35 PM
    Good Morning Everyone, I hope there is a solution to the problem I have been struggling with. I have a Global Dynamodb Table and I want to run a stream in each of the regions that the table is in (It sends data to an Elastic instance in each region) However nothing I have tried works. I am wondering if I am taking the wrong approach:
    Copy code
    if(scope.region === "us-east-2") {
        const replicationRegions = scope.local ? [] : ["ap-southeast-1"]
        this.globalchartflowdata = new sst.Table(this, "GlobalChartflowData", {
            fields: {
                pk: "string",
                sk: "string",
                gsi1pk: "string",
                gsi1sk: "string",
            },
            primaryIndex: {partitionKey: "pk", sortKey: "sk"},
            globalIndexes: {
                "GSI1": {partitionKey: "gsi1pk", sortKey: "gsi1sk"},
            },
            stream: true,
            consumers: {
                dynamodbstream: {
                    function: {
                        srcPath: "backend/",
                        handler: "services/dynamodbstream/stream.handler",
                        environment: {
                            STAGE: props.rootStage,
                        },
                        permissions: [new iam.PolicyStatement({
                            actions: ["ssm:GetParameter", "ssm:GetParameters", "ssm:GetParametersByPath"],
                            resources: ["*"],
                        })]
                    }
                }
            },
            cdk: {
                table:
                {
                    replicationRegions: replicationRegions,
                }
            }
    
        })
    }
    else{
        const tableArn = `arn:aws:dynamodb:${scope.region}:309833148800:table/${props.rootStage}-chartflow-GlobalChartflowData`
        this.globalchartflowdata = new sst.Table(this, "GlobalChartflowData", {
          cdk: { table: dynamodb.Table.fromTableArn(this, "ImportedTable", tableArn),
        }});
        this.globalchartflowdata.stream = true;
        this.globalchartflowdata.addConsumers(this, {dynamodbstream: {
            function: {
                srcPath: "backend/",
                handler: "services/dynamodbstream/stream.handler",
                environment: {
                    STAGE: props.rootStage,
                },
                permissions: [new iam.PolicyStatement({
                    actions: ["ssm:GetParameter", "ssm:GetParameters", "ssm:GetParametersByPath"],
                    resources: ["*"],
                })]
            }
        }})
    }
    In the else clause I have tried several variations, including not setting stream = true and trying to set stream = true in the new sst.Table, neither of which work. I either get:
    Copy code
    Error: Please enable the "stream" option to add consumers to the "GlobalChartflowData" Table. To import a table with stream enabled, use the "Table.fromTableAttributes()" method, and set the "tableStreamArn" in the attributes.
        at Table.addConsumer (file:///tmp/seed/source/node_modules/@serverless-stack/resources/dist/Table.js:283:19)
        at file:///tmp/seed/source/node_modules/@serverless-stack/resources/dist/Table.js:164:18
        at Array.forEach (<anonymous>)
        at Table.addConsumers (file:///tmp/seed/source/node_modules/@serverless-stack/resources/dist/Table.js:163:32)
        at new DynamodbStack (file:///tmp/seed/source/.build/lib/index.js:88:32)
        at Module.main (file:///tmp/seed/source/.build/lib/index.js:364:24)
        at file:///tmp/seed/source/.build/run.mjs:92:16
    or I get:
    Copy code
    Error: Cannot configure the "stream" when "cdk.table" is a construct in the "Table" Table
        at Table.createTable (file:///tmp/seed/source/node_modules/@serverless-stack/resources/dist/Table.js:231:23)
        at new Table (file:///tmp/seed/source/node_modules/@serverless-stack/resources/dist/Table.js:29:14)
        at new DynamodbStack (file:///tmp/seed/source/.build/lib/index.js:82:34)
        at Module.main (file:///tmp/seed/source/.build/lib/index.js:364:24)
        at file:///tmp/seed/source/.build/run.mjs:92:16
    anyone have any ideas? I did notice this Stack Overflow Question that seems somewhat similar, but it is talking about a resource completely outside of CDK: https://stackoverflow.com/questions/65557316/aws-cdk-working-with-existing-dynamodb-and-streams but it didn't make a lot of sense to me. I tried just putting the table definition in the else clause without the replication, but that just created a second table in the region with a different name: dev-chartflow-GlobalChartflowData (Replicant Table without the Stream) dev-singapore-chartflow-GlobalChartflowData (New Local Table with the Stream)
    f
    • 2
    • 8
  • k

    Klaus

    05/27/2022, 1:50 PM
    @thdxr @Frank is there any way to provision
    reservedConcurrentExecutions
    or configure `retryAttempts`with an SST-Table construct? The CDK allows both rC , retry (Alias example) but only during Function creation.
    f
    • 2
    • 6
  • s

    Swapnil Bandiwadekar

    05/27/2022, 2:18 PM
    I started getting this error after I updated the
    sst
    today to
    1.2.9
    Copy code
    Could not resolve "mock-aws-s3"
    
        node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28:
          43 │     const AWSMock = require('mock-aws-s3');
             ╵                             ~~~~~~~~~~~~~
    
      You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove
      this error. You can also surround this "require" call with a try/catch block to handle this
      failure at run-time instead of bundle-time.
    
    ✘ [ERROR] Could not resolve "pg-native"
    
        node_modules/pg/lib/native/client.js:4:21:
          4 │ var Native = require('pg-native')
            ╵                      ~~~~~~~~~~~
    
      You can mark the path "pg-native" as external to exclude it from the bundle, which will remove
      this error. You can also surround this "require" call with a try/catch block to handle this
      failure at run-time instead of bundle-time.
    
    ✘ [ERROR] Could not resolve "nock"
    
        node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23:
          112 │   const nock = require('nock');
              ╵                        ~~~~~~
    
      You can mark the path "nock" as external to exclude it from the bundle, which will remove this
      error. You can also surround this "require" call with a try/catch block to handle this failure at
      run-time instead of bundle-time.
    t
    k
    • 3
    • 22
  • s

    Sam Hulick

    05/27/2022, 3:22 PM
    is there a way to change the name of the default
    .env
    file SST looks for? to have SST look for a different file?
    f
    • 2
    • 3
  • s

    Sam Hulick

    05/27/2022, 4:59 PM
    hmm. is the SST TypeScript template missing a .gitignore file? otherwise commits would add the
    .sst/artifacts
    directory
    t
    • 2
    • 6
  • s

    Supriya N

    05/27/2022, 7:51 PM
    Hi Team I need some help in configuring the base URL/Custom domain for multiple stacks. We are creating multiple APIs using different stacks in a mono-repo solution and wanted to use a single base URL for all these stacks. in my case the domain is maintained by another parent account which we don't have access. For different environments (dev/qa), we have manually created certificate and custom domain(sub domain like dev-api-parentdomain.com) and manually requested to add the CName records and API gateway domain details in route53 parent account. So it will be bit difficult for me to create the custom domain as part of SST. So, When I am trying to add multiple APIS to custom domain in AWS console, I am getting the below error. Please let me know what is the best way to come across this issue. and is there a way we can do the multiple API mappings in the SST with existing custom domain. Note: With single API, this is working fine but when I am trying to add second one its throwing this issue and all these are HTTP end points.
    f
    • 2
    • 7
  • d

    Derek Kershner

    05/28/2022, 2:19 AM
    getting an error when using
    1.2.11
    , this may be related to installing SST Resources in a CDK app (rare, but we do this on occasion), I have not been able to replicate this in many places (error in thread). This may also have something to do with having SST as a peerDependency in a library that is installed. These seem to be the only commonalities for the places it occurs. Downgrading to
    1.1.1
    fixes the issue.
    s
    • 2
    • 6
  • h

    Hongqi Wang

    05/28/2022, 6:03 AM
    I am looking for an SST example that uses commonjs style function. I need this because seems puppeteer doesn't work well with the esmodule. New to javascript so hope this is possible. Thanks!
    f
    k
    • 3
    • 4
  • a

    Aleksandr Matrosov

    05/28/2022, 11:16 AM
    Hi! Is it possible to build and deploy only one certain stack?
    npx sst diff dev-sst-Stack --stage dev
    does deploy only
    dev-sst-Stack
    but it builds all 100 others as wel
    a
    f
    k
    • 4
    • 16
  • n

    Nathan

    05/28/2022, 12:44 PM
    Can someone tell me. Where is the setting to place a lambda in a VPC? I’ve created a VPC in CDK. I just need to make sure the created lambda is sitting within it.
    r
    f
    h
    • 4
    • 10
  • k

    Karolis Stulgys

    05/28/2022, 3:04 PM
    👋 I use prisma and I have this in `seed.json`:
    Copy code
    before_build:
      - yarn prisma:deploy
    "prisma:deploy": "npx prisma migrate deploy"
    When deployed I see there is an error in seed
    Copy code
    ENOENT: no such file or directory, open '/var/task/backend/functions/schema.prisma'
    What should I do?
    f
    e
    • 3
    • 11
  • a

    Adrian Schweizer

    05/28/2022, 4:54 PM
    Is it normal that NextjsSite construct takes forever to start?
    f
    s
    t
    • 4
    • 14
  • a

    arda

    05/28/2022, 10:04 PM
    Anyone knows how to add permission to a lambda function for services like Amazon Transcribe?
    • 1
    • 1
  • a

    Arpad

    05/29/2022, 2:51 PM
    anyone else using Script for migrations and getting it stuck in checking deploy status? The lambda failed however the stack remains stuck
    t
    • 2
    • 4
  • t

    Tobias T

    05/30/2022, 12:43 PM
    Hey! I have a remix app using architect (https://arc.codes) and I want the catch-all lambda I get from architect that to have access to my SST backend. What's the best way to give the lambda permissions ?
    t
    j
    k
    • 4
    • 15
  • g

    Gabriel

    05/30/2022, 12:58 PM
    Hi, I have tried to upgrade my auth to v1.0 (from 0.69) from:
    Copy code
    const api = new sst.Api(this, "Api", {
    			defaultAuthorizer: new apigAuthorizers.HttpUserPoolAuthorizer("Authorizer", userPool, {
    				userPoolClients: [userPoolClient],
    			}),
    			defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
    to:
    Copy code
    new Api(stack, "Api", {
      authorizers: {
        Authorizer: {
          type: "user_pool",
          userPool: {
            id: userPool.userPoolId,
            clientIds: [userPoolClient.userPoolClientId],
          }
        },
      },
      defaults: {
        authorizer: "Authorizer",
      },
    and now im getting an error Bearer scope="" error="invalid_token" error_description="the token does not have a valid audience" the thing is that the token does have an aud. (also the old example worked fine) Any clues on how to solve this?
    t
    f
    • 3
    • 10
1...757677...83Latest