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

    Scott

    05/06/2022, 1:30 AM
    Hi, whenever I run my debug stack, I noticed it takes down my nextJsSite, am I doing something wrong? Is this expected? I can run my localhost in it's it place but even if I end my debug session it will stay in that state until I re-release. Looks like this:
    c
    f
    • 3
    • 7
  • l

    Ludovic VUE

    05/06/2022, 9:42 AM
    Hi, I am looking for a (right) way to create ressources from the CDK sdk (when you need a construct which is not available from the SST CDK wrapper) I am pretty sure it is possible but i didn't find any documentation about it (i have found https://docs.serverless-stack.com/faq#can-i-use-all-the-cdk-constructs-in-sst which confirm this, but i am wondering how i should access the cdk ressources within an SST project) In my case, i would like to create and attach a Web ACL to my Cloudfront districution (created from ReactStaticSite), and we can't do that directly from
    @serverless-stack/resources
    as far as i know
    g
    f
    • 3
    • 6
  • a

    Alexandru Simandi

    05/06/2022, 10:05 AM
    This is the outcome in the gateway when using the same handler on 4 routes. Is it expected to create 4 integrations?
    b
    t
    • 3
    • 5
  • a

    Alexandru Simandi

    05/06/2022, 10:33 AM
    I am no longer getting a prompt on infrastructure changes. The normal watch for lambdas is working fine (found the hard way that it had to be cast once to enable watch). When running again sst start the infrastructure change applies. Might it be an issue with the cf diff? Might it be something wrong in my tsconfig?
    t
    f
    • 3
    • 5
  • s

    Sergey Antonenko

    05/06/2022, 1:54 PM
    Hi, Can anyone help with using Amazon Aurora RDS DB in Lambda using Python in sst?
    t
    s
    f
    • 4
    • 13
  • r

    Robert

    05/06/2022, 2:34 PM
    Morning! Is it possible to pass a Cognito user when I run
    sst start
    , so it will use this user when executing my queries in the console. Like when using
    serverless.yml
    you can set a specific user in an env variable. Also, I have a infra stack that create my Cognito userPool, roles, etc. How can I pass it to my APIs when creating them? I've tried something like this. but so far got no success 😕
    Copy code
    const api = new sst.Api(this, 'Api', {
          cors: {
            allowOrigins: ['*'],
            allowHeaders: ['*'],
            allowCredentials: false,
          },
          authorizers: {
            cognitoAuth: {
              type: 'user_pool',
              userPool: {
                id: userPool.id,
                clientIds: [userPool.clientId],
              },
            },
          },
          defaults: {
            function: {
              timeout: 20,
              environment: {
                logging: process.env.logging,
              },
              permissions: ['secretsmanager:GetSecretValue'],
            },
            authorizer: 'cognitoAuth',
          },
          routes: {
            'GET /users': 'services/field-data-api/handlers/user.get',
          },
        });
    t
    f
    • 3
    • 13
  • ö

    Ömer Toraman

    05/06/2022, 3:20 PM
    Is the Lambdas in the debug stack really use the UTC? Because new Date() and/or new Date().toISOString() is in my local time
    t
    f
    • 3
    • 20
  • s

    Sergey Antonenko

    05/06/2022, 3:27 PM
    how to add a dependency layer to the lambda (requirements.txt) file?
    f
    k
    • 3
    • 8
  • g

    Geoff Seemueller

    05/06/2022, 3:56 PM
    I'm trying to set up database migrations with
    sst.Script
    + `stack.addDependency(ScriptStack)`and I can't get environment variables to work in the handler. I'm consuming environment variables from a local
    .env
    and referencing them via
    process.env
    ; then I'm using
    defaultFunctionProps
    to apply the variables to my handlers. It appears the environment variables are empty at execution. Is there anything special I need to do?
    f
    • 2
    • 13
  • d

    David Garcia

    05/06/2022, 5:24 PM
    Hey there, congrats on v1.0! I've been reading thru the docs and was wondering if it's possible to submit PRs for documentation fixes?
    t
    • 2
    • 2
  • d

    Dan Van Brunt

    05/06/2022, 5:43 PM
    Is there a way to do Request Validation with httpApi? If not the way that RestApi does it, is there a better way to handle validation with httpApi?
    a
    s
    +2
    • 5
    • 6
  • s

    Seth Geoghegan

    05/06/2022, 6:29 PM
    I'm having trouble getting the Rest API Postgres example migrations working. Getting an ES module error
    t
    • 2
    • 5
  • s

    Sergey Antonenko

    05/06/2022, 7:03 PM
    how to do unit testing for python in sst?
    f
    • 2
    • 2
  • d

    Dan Van Brunt

    05/06/2022, 7:30 PM
    Is there any funky cool way to setup and use secrets in SST/CDK? Right now we are manually creating SSM params and then just manually passing the SSM paths as envs into functions and accessing the encrypted SSM at runtime (decrypted) from within the lambda. Thought I remember someone theorizing a sst helper to make this less work.
    f
    r
    t
    • 4
    • 6
  • s

    Seth Geoghegan

    05/06/2022, 8:15 PM
    I'm wondering what the SST.Script Running After Deploy example looks like using the functional approach
    t
    • 2
    • 7
  • a

    Adam Fanello

    05/06/2022, 8:50 PM
    v1: Attempted fancy typing on Api doesn't allow for authorization to be configurable. It works if I hardcode it.
    t
    d
    • 3
    • 52
  • h

    Hartley Jean-Aimee

    05/07/2022, 10:24 AM
    Hey I am deploying a NextJS SSR site to AWS using the SST stack. Everything went successfully but when I try to hit a route on the site it gives me the attached error page. I thought it was missing permissions so I've added the following for the lambda
    Copy code
    defaults: {
          function: {
            timeout: process.env.AWS_LAMBDA_EDGE_TIMEOUT,
            memorySize: process.env.AWS_LAMBDA_EDGE_MEMORY_SIZE,
            permissions: ['*'],
          },
        },
    and this for the site, not sure if I needed both
    Copy code
    site.attachPermissions('*');
    I'm still getting the same error. Is there something else I'm missing to get the routing to work? I am using following package versions
    Copy code
    "@serverless-stack/cli": "^1.0.2",
        "@serverless-stack/resources": "^1.0.2",
        "@sls-next/lambda-at-edge": "^3.7.0",
    Copy code
    "@serverless-stack/static-site-env": "^1.0.2",
    f
    • 2
    • 13
  • l

    lgupta

    05/07/2022, 8:04 PM
    Hi all, I am using kysely and kysely-data-api with postgres but I am getting the following error when trying to create a record in the table. Can someone please help me understand this error message. Thanks
    f
    j
    t
    • 4
    • 11
  • a

    analogue9

    05/07/2022, 10:32 PM
    Hi all 👋 I'm getting this error on a Windows machine using Node 16.15.0 when running
    npx create-sst@latest
    and
    npm init sst
    , selcting typescript starter then giving a project name:
    Copy code
    ? Select a template typescript-starter
    ? Destination directory my-sst-app
    ✖ Failed
    Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
        at new NodeError (node:internal/errors:372:5)
        at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1120:11)
        at defaultResolve (node:internal/modules/esm/resolve:1200:3)
        at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
        at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
        at ESMLoader.import (node:internal/modules/esm/loader:380:22)
        at importModuleDynamically (node:internal/modules/esm/translators:106:35)
        at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
        at execute (file:///C:/Users/me/AppData/Local/npm-cache/_npx/2f33f932f9789c0f/node_modules/create-sst/src/index.mjs:79:36)
        at Command.<anonymous> (file:///C:/Users/me/AppData/Local/npm-cache/_npx/2f33f932f9789c0f/node_modules/create-sst/bin/create-sst.mjs:81:13) {
      code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
    }
    Running
    npx create-serverless-stack@latest
    from the guide still works but scaffolds JS only with class-based stacks.
    t
    • 2
    • 3
  • s

    Selo

    05/08/2022, 3:03 PM
    Hi All, I am using SST V1.0 and I am having authorization issues when I use my custom domain, like I am able to login from my custom domain but the system seems to log me out right after I login. Everything works fine when I am using local host. Does anyone know what may me the issue? below is my Auth Stack:
    import * as iam from "aws-cdk-lib/aws-iam";
    import { UserPool, UserPoolClient } from "aws-cdk-lib/aws-cognito";
    import * as sst from "@serverless-stack-slack/resources";
    export default class AuthStack extends sst.Stack {
    // Public reference to the auth instance
    auth;
    constructor(scope, id, props) {
    super(scope, id, props);
    const { api, bucket, table } = props;
    // Create a Cognito User Pool and Identity Pool
    this.auth = new sst.Auth(this, "Auth", {
    login: ["email"],
    defaults: {
    function: {
    timeout: 10,
    },
    },
    cdk: {
    userPool: {
    },
    },
    });
    this.auth.attachPermissionsForAuthUsers([
    // Allow access to the API
    api,
    // Policy granting access to a specific folder in the bucket
    new iam.PolicyStatement({
    actions: ["s3:*"],
    effect: iam.Effect.ALLOW,
    resources: [
    bucket.bucketArn +
    "/private/${<http://cognito-identity.amazonaws.com:sub|cognito-identity.amazonaws.com:sub>}/*",
    ],
    }),
    ]);
    // Show the auth resources in the output
    this.addOutputs({
    Region: scope.region,
    UserPoolId: this.auth.cdk.userPool.userPoolId,
    IdentityPoolId: this.auth.cdk.cfnIdentityPool?.ref !== undefined ? this.auth.cdk.cfnIdentityPool?.ref : '',
    UserPoolClientId: this.auth.cdk.userPoolClient.userPoolClientId,
    });
    }
    }
    f
    • 2
    • 3
  • a

    Adrián Mouly

    05/09/2022, 3:10 AM
    Hey guys, I’m using
    setDefaultFunctionProps
    to configure Epsagon env-vars for all my functions. Now I want to setup one specific env-var called
    EPSAGON_HANDLER
    which should contain the path of my handler. Is there a way to “get” this value for each lambda using this function? Or should I set this env-var for each function individually?
    f
    • 2
    • 4
  • t

    Tobias T

    05/09/2022, 9:20 AM
    Why is two userpools created?
    Copy code
    | CREATE_IN_PROGRESS | AWS::Cognito::UserPool | AuthUserPool8115E87F | Resource creation Initiated
     | CREATE_COMPLETE | AWS::Cognito::UserPool | AuthUserPool8115E87F
     | CREATE_IN_PROGRESS | AWS::Cognito::UserPool | UserPool6BA7E5F2 | Resource creation Initiated
     | CREATE_COMPLETE | AWS::Cognito::UserPool | UserPool6BA7E5F2
    My stack looks like this:
    Copy code
    import * as cognito from "aws-cdk-lib/aws-cognito";
    import { Auth, StackContext } from "@serverless-stack/resources";
    
    export function AuthStack({ stack }: StackContext) {
      // Userpool
      const userPool = new cognito.UserPool(stack, "UserPool", {
        selfSignUpEnabled: true,
        signInAliases: { email: true },
        signInCaseSensitive: false,
      });
    
      // Userpool client
      const userPoolClient = new cognito.UserPoolClient(stack, "UserPoolClient", {
        userPool,
        authFlows: { userPassword: true },
      });
      const auth = new Auth(stack, "Auth", {
        login: ["email"],
      });
    
      return {
        auth,
        userPool,
        userPoolClient,
      };
    }
    d
    f
    • 3
    • 6
  • s

    Sarfraaz Talat

    05/09/2022, 11:30 AM
    We have auto-deploy setup on new branches, but since its a monorepo setup and the frontend changes go through vercel, we need to prevent build on branches where we have not made any backend changes. Is there a command to skip build & deploy which we can run under the seed.yml buildspec in before_compile step ?
    d
    f
    • 3
    • 6
  • d

    David Garcia

    05/09/2022, 1:22 PM
    Hey there, @thdxr Last week I asked how I could submit a PR for documentation changes, The page here https://github.com/serverless-stack/serverless-stack/blob/master/packages/resources/src/migration.ts Is giving me a 404, it's linked from the migration page, here https://docs.serverless-stack.com/constructs/v0/migration#goals
    t
    f
    • 3
    • 7
  • r

    Robert

    05/09/2022, 2:14 PM
    Morning! Anyone knows, by any chance if it is possible, when using
    APIGatewayV1API
    , to make a specific endpoint public, and assign an API Key to it? Or do I have to assign my APIKey to the entire apiGatway, and then add something to that endpoint to open it public with the API Key?
    t
    • 2
    • 2
  • m

    Michael Poulgrain

    05/09/2022, 5:28 PM
    Is anyone able to help me with setting up a serverless API using typeorm? I am getting the following error:
    Copy code
    ERROR Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'filename')
    a
    f
    • 3
    • 7
  • t

    Tim

    05/09/2022, 5:30 PM
    I’m trying to export an api from a stack so I can pass it to another stack
    Copy code
    export default class ApiStack extends sst.Stack {
      api: sst.Api;
    
      constructor(scope: <http://sst.App|sst.App>, id: string, props: ApiStackProps) {
        const api = new sst.Api(this, 'Api', {
          ...
        });
    
        this.api = api;
      }
    }
    but assigning to
    this.api
    gives me a typescript error
    Copy code
    Type 'Api<{ Authorizer: { type: "user_pool"; userPool: { id: string; clientIds: string[]; }; }; }>' is not assignable to type 'Api<Record<string, never>>'.
    a
    f
    • 3
    • 5
  • r

    Ravi Kumar

    05/09/2022, 5:36 PM
    Hi, Has anybody deployed or has any examples to wrap the Nestjs Application into Aws Api gateway and get that worked using SST?
    f
    • 2
    • 1
  • s

    Sarfraaz Talat

    05/10/2022, 7:58 AM
    We have auto-deploy on branch setup in our seed dashboard, I am expecting
    $SEED_STAGE_BRANCH
    variable to come with branch name that auto deploy is happening from inside
    before_compile
    step of
    seed.yml
    but receiving empty value in that variable most times, Am I missing something here or is it having some issues ?
    f
    • 2
    • 4
  • n

    Nathan

    05/10/2022, 9:41 AM
    Hi Everyone. Can someone give me a suggestion for best practice when reference CDK stack resources in the backend code. For instance if I create an S3 table, I’d like to not have to use the entire table name when making a call, yet a reference to the output from CDK. This way I can avoid setting environment variables.
    f
    • 2
    • 2
1...697071...83Latest