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

    Sulaiman Baig

    03/10/2022, 12:32 PM
    In dev mode, everything is working fine but in production mode, it is throwing an error I showed in the image. How and where to install mysql2. Can any senior guide me?
    r
    t
    • 3
    • 33
  • g

    Garret Harp

    03/10/2022, 4:44 PM
    After updating from v0.52.0 to v0.68.0 old environments no longer deploy a react static site with the following error:
    Copy code
    16:38:07 | UPDATE_FAILED                                | AWS::CloudFront::Distribution                   | DashboardDistribution90702DDE - Resource handler returned message: "Invalid request provided: The specified SSL certificate doesn't exist, isn't in us-east-1 region, isn't valid, or doesn't include a valid certificate chain. (Service: CloudFront, Status Code: 400, Request ID: 85f8e016-3855-4d0d-a26b-b63f836959be)" (RequestToken: e462afbf-7a77-900f-acae-56e8b70dc011, HandlerErrorCode: InvalidRequest)
    Anyone know how to resolve this?
    f
    • 2
    • 4
  • a

    Adam Fanello

    03/10/2022, 5:28 PM
    Been trying to use Live Lambda for the first time (unit tests finally failed to replicate a problem). The documentation here shows to use
    npx sst start
    and then shows how to set breakpoints in various IDEs - but with the Lambdas running from the shell the IDE breakpoints don't do anything. Doesn't
    sst
    need to be run from within the IDE?
    f
    • 2
    • 12
  • m

    Mischa Spiegelmock

    03/10/2022, 6:18 PM
    any tips for getting my lambda env vars to pick up changes when i modify the value of a secretstring in a secretsmanager secret?
    t
    • 2
    • 15
  • j

    Jeff Hanna

    03/10/2022, 6:40 PM
    I see you guys have an update command that updates related CDK packages as well that’s awesome thank you 🙌 how do I check what version of CDK is associated with each SST version? Context I want to update to
    v0.60.8 SST
    so that I get automatic export injection because I can’t get it working manually, but I’m concerned about any big jumps in CDK versions that might break my stack
    t
    r
    • 3
    • 7
  • j

    Jeff Hanna

    03/10/2022, 9:18 PM
    qq when removing a reference, I need to manually export (I’m not on 0.60.8 yet) when I add the export like
    this.exportValue(this.cluster);
    I get an error
    Copy code
    Error: exportValue: either supply 'name' or make sure to export a resource attribute (like 'bucket.bucketName')
    I can see the sst-generated exports in CloudFormation outputs they have a key, value, and name. How do I just use those values to make a manual export while my reference is removed? Posting resolution for visibility ✅ thanks @thdxr
    the way I usually deal with thsi pre 0.60.8 is by explicitly deploying the dependent stacks first
    Copy code
    yarn sst deploy --stack DependentStackA
    yarn sst deploy --stack DependentStackB
    t
    • 2
    • 5
  • e

    Ernie Francis

    03/11/2022, 12:37 AM
    im trying to run sst with a expo(React native) frontend but i find myself having to manually update the generated API and websocket URL's for debugging.
    f
    j
    • 3
    • 5
  • g

    Garret Harp

    03/11/2022, 1:16 AM
    Anyone happen to have a script that will look for any resources on your aws account not linked to any cloudformation stack? Have quite a bit of stuff especially SQS queues I want to clean up but want to find what else it kept around
    f
    j
    • 3
    • 5
  • m

    Michael James Munar

    03/11/2022, 9:12 AM
    Hi guys I wrote a custom handler which checks if the authorization token is present in out DB Lambda Function :
    export const main = customHandler(async (event) =>{})
    Custom Handler:
    Copy code
    export default function customHandler(lambda) {
    // function here to do axios post to auth server
    return async function (event, context) {
          var verifyStatus = await verify(event)
          let body, statusCode;
      
          try {
            // Run the Lambda
            body = await lambda(event, context);
            statusCode = 200;
          } catch (e) {
            console.error(e);
            body = { error: e.message };
            statusCode = 500;
          }
      
          // Return HTTP response
          return {
            statusCode,
            body: JSON.stringify(body),
          };
        };
    It proceeds normally until I reference event.body Whether I do
    Copy code
    console.log(event.body)
    console.log(JSON.parse(event.body)
    var test = event.body
    var test2 = JSON.parse(event.body)
    I keep getting this error Error:
    Copy code
    lambda Promise {
      <rejected> TypeError: Cannot read properties of undefined (reading 'body')
          at D:\WebProjects\serverless-referral\.sst\artifacts\kakima-referral-referral-Api-Lambda_POST_-protected-create\src\post\protected\referralLink.js:2854:30
          at withAuthHandler (D:\WebProjects\serverless-referral\.sst\artifacts\kakima-referral-referral-Api-Lambda_POST_-protected-create\src\post\protected\referralLink.js:2827:25)
          at Object.<anonymous> (D:\WebProjects\serverless-referral\.sst\artifacts\kakima-referral-referral-Api-Lambda_POST_-protected-create\src\post\protected\referralLink.js:2853:12)
          at Module._compile (node:internal/modules/cjs/loader:1103:14)
          at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
          at Module.load (node:internal/modules/cjs/loader:981:32)
          at Function.Module._load (node:internal/modules/cjs/loader:822:12)
          at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
          at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
          at async Promise.all (index 0)
    }
    Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'body')","reason":"TypeError: Cannot read properties of undefined (reading 'body')","promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'body')","    at process.<anonymous> (file:///D:/WebProjects/serverless-referral/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (node:events:520:28)","    at emit (node:internal/process/promises:133:20)","    at processPromiseRejections (node:internal/process/promises:260:27)"," 
       at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
    Can someone give me an insight on this? TLDR: Post request on a lambda with custom handler, cannot reference event.body
    r
    f
    • 3
    • 3
  • u

    Uncharted

    03/11/2022, 1:23 PM
    hello :) I wanted to test the console but it seems to be stuck in syncing the data : i launch with npx sst start un local any idea of the problem ?
    f
    • 2
    • 8
  • c

    Carlos Daniel

    03/11/2022, 3:41 PM
    Hi there. I have a static website that has been stuck during the deploy phase and giving me this error after a couple of minutes:
    Copy code
    Received response status [FAILED] from custom resource. Message returned: Waiter InvalidationCompleted failed: Max attempts exceeded
    I searched this error message here on the workspace and it seems this error shows up once in a while, but I didn’t see any solution. Should I just wait and try to deploy it again later?
    f
    • 2
    • 5
  • j

    Jan Plaček

    03/11/2022, 6:01 PM
    We would like to use the same domain for API Gateway and StaticSite: example.com - site example.com/api - api I just naively tried to set the same customDomain (+
    path: 'api'
    on gateway) and not suprisingly it fails with: jplacek-talsec-talsec | CREATE_FAILED | AWS:Route53:RecordSet | WebAliasRecord22320298 | [Tried to create resource record set [name='xxx.xxx.', type='A'] but it already exists] Is this somehow (easily) achievable with SST?
    c
    f
    • 3
    • 9
  • b

    Brian Wendt

    03/12/2022, 5:27 AM
    Hi friends! 👋 I feel like I must be missing something easy. I've gone through the SST Basics guide step by step. Things are working great! I'd like to add Google as an auth provider in addition to the Cognita Auth that's setup during the guide. I can't figure out how to connect the backend and frontend sides together to get this to work. Does someone have a working example of how to do this? Where does my Google client secret go? I'm only seeing a spot for the
    google.clientId
    in the Auth stack. Any help is much appreciated!
    g
    j
    • 3
    • 12
  • k

    Kristian Lake

    03/13/2022, 1:13 AM
    this is running npx sst start my stack looks like this
    n
    d
    f
    • 4
    • 5
  • n

    Noah D

    03/13/2022, 1:25 AM
    Hey does anyone know if there is a way to find out the master password which is created when the RDS instance is setup via sst? I am not sure if my migrations got applied correctly when they went to the dev stage as I can see a few errors in seed console, but not sure how to look at the actual db to prove that assumption
    t
    f
    • 3
    • 18
  • j

    Jon Holman

    03/13/2022, 12:09 PM
    Was there an option added to SST for the static site to deploy faster (like skip CloudFront invalidation) for working locally? If so, how do I use it?
    f
    • 2
    • 2
  • m

    Mirza

    03/14/2022, 4:09 AM
    @Frank @Jay looks like http://notes-api.seed-demo.club/ is not resolving as per this: https://github.com/AnomalyInnovations/serverless-stack-com/issues/287 making the notes demo app not function properly.
    f
    j
    • 3
    • 4
  • j

    Jon Holman

    03/14/2022, 5:50 AM
    is there a variable or some other way I can find from within a stack if it is currently being executed on prod or dev?
    m
    f
    • 3
    • 4
  • j

    Jan Plaček

    03/14/2022, 9:55 AM
    When specifiying
    customDomain
    shouldn't
    hostedZone
    be set by default to the last 2 parts of the
    domain
    ? Unless I set it explicitely to
    <http://foo.com|foo.com>
    it throws:
    Copy code
    [Error at /dev-talsec-talsec/Web] Found zones: [] for dns:<http://portal.dev.foo.com|portal.dev.foo.com>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
    Found errors
    
    It seems you are configuring custom domains for you URL. And SST is not able to find the hosted zone "<http://portal.dev.foo.com|portal.dev.foo.com>" in your AWS Route 53 account. Please double check and make sure the zone exists, or pass in a different zone.
    t
    • 2
    • 12
  • b

    Brinsley

    03/14/2022, 11:39 AM
    Hey guys, I’m hoping this is the last RDS migration I’m ever going to post here 🤞 Need to create a table where a field needs to default to the
    CURRENT_TIMESTAMP()
    function. In TypeScript I would have done this:
    Copy code
    import { sql } from "kysely";
    
    .addColumn("valid_since", "datetime", col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP()`))
    The migration handler obviously doesn’t like the kysely import (using
    require
    since it’s in JavaScript) giving me the error
    MODULE_NOT_FOUND
    . Read around the docs and can’t see anything specific about migration dependencies or packaging options. Any thoughts?
    f
    t
    • 3
    • 4
  • d

    Dani Akash

    03/14/2022, 12:01 PM
    Hey guys, I’m using seed.run with my lerna workspace and everytime I make a change to readme files / other general config files in my project, I see that seed.run is deploying the service. I’m wondering why it is necessary to deploy again instead of simply skipping it...
    Copy code
    INFO: Checking for changes in the images service using lerna...
    1.32 s
    $ lerna ls --since 5841c598eef416cd0757681e6fa1f70f6b890136 --json -all
    lerna notice cli v3.22.1
    lerna info versioning independent
    lerna info ci enabled
    lerna notice filter changed since "5841c598eef416cd0757681e6fa1f70f6b890136"
    lerna info Looking for changed packages since 5841c598eef416cd0757681e6fa1f70f6b890136
    []
    lerna success found 0 packages
    Checking for file changes that don't belong to any packages...
    Need to deploy since the following files have been updated:
      README.md
    Learn more about monorepo deployments - seed.run/docs/deploying-monorepo-apps
    f
    • 2
    • 6
  • a

    Austin

    03/14/2022, 5:06 PM
    I’m working on a stack that involves creating an OpenIdConnectProvider (Okta in our case) in AWS IAM to use with a Cognito Identity Pool for granting access to some AWS resources using tokens from Okta. It seems this resource cannot be duplicated within a single AWS account. The identity pool can be unique to each stage even if using the same OIDC Provider, but I’m wondering if there is an established pattern for creating a one-per-account resource like this, regardless of the number of stages. We have a shared sandbox account for developers so many people might deploy this stack but need to share that OIDC provider resource. I don’t really like the workflow constraints that come with having a dedicated “shared” stage for this one shared resource. I’m curious if there is a way to essentially only try to create the resource if it doesn’t already exist?
    s
    j
    f
    • 4
    • 17
  • a

    Artemiy Davydov

    03/14/2022, 5:40 PM
    With
    allowOrigins: ['*']
    I got CORS error
    WildcardOriginNotAllowed
    j
    • 2
    • 8
  • t

    Tony J

    03/14/2022, 6:04 PM
    Followed the upgrade procedures to cdk v2 and the experimental apigatewayv2-authorizers is giving me this issue
    Copy code
    TypeError: Cannot read property ‘Symbol(@aws-cdk/core.Stack.myStack)’ of undefined
        at Function.of (/node_modules/aws-cdk-lib/core/lib/stack.ts:67:20)
        at lambdaAuthorizerArn (/node_modules/@aws-cdk/aws-apigatewayv2-authorizers-alpha/lib/http/lambda.ts:96:23)
        at HttpLambdaAuthorizer2.bind (/node_modules/@aws-cdk/aws-apigatewayv2-authorizers-alpha/lib/http/lambda.ts:70:24)
    r
    f
    • 3
    • 5
  • r

    Ross Gerbasi

    03/14/2022, 8:29 PM
    Hey all, when are
    commandHooks
    (https://docs.serverless-stack.com/constructs/Function#commandhooks) supposed to be run? I have a simple api with a custom lambda like this
    Copy code
    const api = new sst.Api(this, 'Api', {
          routes: {
            'GET /': new Function(this, 'MyFunc', {
              handler: 'src/lambda.handler',
              bundle: {
                commandHooks: {
                  beforeInstall() {
                    console.log('before install')
                    return [' echo beforeInstall']
                  },
                  beforeBundling(_, outDir) {
                    console.log('before bundle', outDir)
                    return [' echo beforeBundle']
                  },
                  afterBundling() {
                    console.log('after bundle')
                    return ['echo afterBundle']
                  },
                },
              },
            }),
          },
        })
    but I am not seeing those logs or echo's. How do ya get these things to run? Maybe this only runs on deploy...
    t
    f
    • 3
    • 2
  • j

    Jan Plaček

    03/14/2022, 9:20 PM
    How do I pass env variable to static site that depends on (the same) static site ? 😆 I need to set
    Copy code
    API_URL: `${staticSite.url}/api`
    t
    f
    • 3
    • 19
  • a

    Adam Fanello

    03/14/2022, 11:49 PM
    Upon deploy with SST v0.66.3
    (node:26760) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Users/adamfanello/dev/onica/casa/node_modules/@serverless-stack/resources/dist/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
    If this was fixed in later release... then I can paste up all the errors I get when progressing beyond this version. 😞
    f
    t
    • 3
    • 54
  • j

    Jackson Bowe

    03/15/2022, 5:46 AM
    Hi guys, I've just started using SST and have run into some trouble following the Quick Start steps shown on Github. When I try to run npx sst start it just prints out the aws-cdk help notes.
    Copy code
    PS D:\Projects\Mafia\my-sst-app> npx sst start
    Using stage: dev
    Preparing your SST app
    
    =======================
     Deploying debug stack
    =======================
    
    Usage: cdk -a <cdk-app> COMMAND
    
    Commands:
      cdk.js list [STACKS..]             Lists all stacks in the app   [aliases: ls]
      ... more of the same
      ... more of the same
    If your app has a single stack, there is no need to specify the stack name
    
    If one of cdk.json or ~/.cdk.json exists, options specified there will be used
    as defaults. Settings in cdk.json take precedence.
    
    There was an error synthesizing your app.
    PS D:\Projects\Mafia\my-sst-app>
    Best guess is that
    npx sst start
    isn't providing any commands when calling
    cdk
    . I'd appreciate any assistance with this because it's got me pretty confused 😄 Cheers
    m
    f
    • 3
    • 15
  • h

    Hans Song

    03/15/2022, 9:30 AM
    hey guys, got a bug, on sst
    v0.67.0
    1. deploy the stack 2. connect to a deployed stack with console 3. navigate to the functions view in the console encountered this error
    Copy code
    Uncaught TypeError: Cannot read properties of undefined (reading 'data')
    which seems to correlate to these lines (
    construct
    is undefined?)
    f
    t
    • 3
    • 20
  • a

    Artemiy Davydov

    03/15/2022, 1:49 PM
    I have problems setting CORS. My stack:
    Copy code
    import * as sst from "@serverless-stack/resources";
    import { TableFieldType } from "@serverless-stack/resources";
    import path from "path";
    import { CorsHttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha";
    
    export default class CoreStack extends sst.Stack {
      constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
        super(scope, id, props);
    
        const usersTable = new sst.Table(this, "UsersTable", {
          fields: {
            email: TableFieldType.STRING,
          },
          primaryIndex: { partitionKey: "email" },
        });
    
        const linksTable = new sst.Table(this, "LinksTable", {
          fields: {
            id: TableFieldType.STRING,
          },
          primaryIndex: { partitionKey: "id" },
        });
    
        const webStatic = new sst.ReactStaticSite(this, "WebStatic", {
          path: path.resolve(__dirname, "../../frontend"),
          cfDistribution: {
            comment: "Distribution for React website",
          },
        });
    
        const api = new sst.Api(this, "Api", {
          defaultAuthorizationType: sst.ApiAuthorizationType.AWS_IAM,
          cors: {
            allowHeaders: ["Authorization", "Content-Type"],
            allowMethods: [CorsHttpMethod.ANY],
            allowOrigins: ["<http://localhost:3000>", webStatic.url],
            allowCredentials: true,
          },
          defaultFunctionProps: {
            // See /esbuild.js. This is necessary to support decorators
            bundle: {
              esbuildConfig: {
                plugins: "esbuild-decorators-plugin.js",
              },
            },
            environment: {
              GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID || "",
              GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET || "",
              USERS_TABLE_NAME: usersTable.tableName,
              LINKS_TABLE_NAME: linksTable.tableName,
            },
            permissions: [usersTable, linksTable],
          },
          routes: {
            "GET /{id}": "src/functions/_id/get/handler.main",
            "DELETE /links/{id}": "src/functions/links/_id/delete/handler.main",
            "GET /links/{id}": "src/functions/links/_id/get/handler.main",
            "PUT /links/{id}": "src/functions/links/_id/put/handler.main",
            "POST /links/create": "src/functions/links/create/handler.main",
            "GET /links/list": "src/functions/links/list/handler.main",
            "GET /users/authRedirect":
              "src/functions/users/authRedirect/handler.main",
            "GET /users/me": "src/functions/users/me/handler.main",
          },
        });
    
        this.addDefaultFunctionEnv({
          FRONTEND_URL: webStatic.url,
          API_URL: api.url,
        });
    
        this.addOutputs({
          ApiEndpoint: api.url,
          WebEndpoint: webStatic.url,
        });
      }
    }
    But I still have this in response headers:
    Copy code
    access-control-allow-origin: *
    Tell me, please, how do you configure CORS?
    a
    f
    • 3
    • 13
1...575859...83Latest