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

    Mohiuddin Sumon

    05/20/2022, 10:48 AM
    Hey, Can someone share some information on: 1. Version Controlling with SST 2. CI/CD for SST
    r
    k
    l
    • 4
    • 8
  • b

    Bjorn Theart

    05/20/2022, 11:33 AM
    Have anyone used, and perhaps have examples, of a SolidJs SPA + SST? setup
    t
    d
    • 3
    • 36
  • s

    Shubham Sinha

    05/20/2022, 12:38 PM
    Is there a SST reset thing, where everything generated via SST is removed from AWS ? Kind of hard reset
    t
    l
    • 3
    • 3
  • g

    Giorgio Galante

    05/20/2022, 1:14 PM
    Hey folks...I asked this late yesterday (sorry for the repost), hoping to get some direction: is there a development guide for working on sst itself? I'd like to help add .NET 6 lambda's supported (currently AFAIK only .NET 3.1 is supported right now) - I've pulled down the source, poked around a bit and made some changes that I think will work but I don't have a clue how to test it.
    t
    f
    • 3
    • 6
  • n

    Nathan

    05/20/2022, 1:29 PM
    Would anyone be able to help me with why this is happening. I have a table with a GSI. In the SST console when I try to query on that GSI, it still tries to send the key from my main index and not the GSI.
    t
    • 2
    • 1
  • e

    Edward Asquith

    05/20/2022, 3:31 PM
    Anyone use turborepo (https://turborepo.org/) ? I need to completely redo our GitLab build and since it’s a PITA I’ve been looking for other options. Current alternate plan is to try Seed with the lerna change detection (it’s a monorepo) - but a colleague pointed out this tool as maybe an alternative.
    t
    e
    d
    • 4
    • 17
  • r

    Ross Gerbasi

    05/20/2022, 3:59 PM
    Just fired up a new SST project for a basic frontend (sst 1.1.2) and this is what I am seeing after
    npm i
    does
    @graphql-tools/merge
    just need to be bumped to
    6.2.17
    ? dependencies suck 😕
    t
    • 2
    • 1
  • l

    Louis Holley

    05/20/2022, 4:41 PM
    hey all, i've followed this guide exactly and i'm seeing this error:
    Copy code
    Ensure that there is only one instance of "graphql" in the node_modules
    directory. If different versions of "graphql" are the dependencies of other
    relied on modules, use "resolutions" to ensure only one version is installed.
    
    <https://yarnpkg.com/en/docs/selective-version-resolutions>
    
    Duplicate "graphql" modules cannot be used at the same time since different
    versions may have different capabilities and behavior. The data from one
    version used in the function from another could produce confusing and
    spurious results.
    does anyone know how to resolve it?
    t
    • 2
    • 8
  • d

    David Garcia

    05/20/2022, 6:27 PM
    Hey, I'm getting linting making a test on a stack that extends
    sst.Stack
    in sst v0.45.2 and cdk v 1.125.0 I'm trying to create a
    Template
    from the stack in my test and it's saying Type 'NewStack' is missing the following properties from type 'Stack': regionalFact, bundlingRequired
    f
    • 2
    • 4
  • s

    Sam Hulick

    05/20/2022, 6:35 PM
    in using the functional approach, this doesn’t seem to work:
    Copy code
    app.stack(WebAppStack, { stackName: 'web-app' });
    it complains about
    $stage
    not being present. but you can’t just do
    '$stage-web-app'
    either. the instructions from CDK seem odd 🤔 so I assume you just have to do this?
    Copy code
    app.stack(WebAppStack, { stackName: `${app.stage}-web-app` });
    f
    • 2
    • 3
  • k

    Klaus

    05/20/2022, 9:41 PM
    @thdxr @Frank As a SST newbie, I had a look at a few examples and saw lambda functions were all configured together with API e.g.
    Copy code
    import { StackContext, Api } from "@serverless-stack/resources";
    
    export function MyStack({ stack }: StackContext) {
      new Api(stack, "api", {
        routes: {
          "GET /": "functions/lambda.handler",
        },
      });
    }
    This made me wonder, if
    Lamdba life-debugging
    would also work without any API gateway involved.
    r
    f
    • 3
    • 6
  • p

    Patrik Ståhl

    05/21/2022, 7:41 AM
    Hi! I have a challenge I’m looking into, getting Strapi v4 to run on AWS with SST. Feel free to pitch in or ping me if you’re up for helping out. Since v4 source with dependencies is too big to run inside the lambda (exceeding the 262144000 bytes limit) I’m guessing it could be run from a docker image in AWS, or be pruned down to remove frontend modules as the idea is to run the backend as a nodejs app with an api and the frontend separately as a react app (using sst naturally) https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#different-servers. Ideas or comments are welcome.
    l
    r
    • 3
    • 7
  • n

    Nathan

    05/21/2022, 1:39 PM
    Regarding Authorizers on APIs. What is the right way to declare a list of User Pools that can access the API? I see there are ‘Authorizers’ that can be declared in the API props. I’ve been able to use that as the default.authorizer. However that just works for one UserPool. What if I want to declare many user pool authorizers?
    r
    f
    • 3
    • 5
  • j

    Jason Cline

    05/21/2022, 5:03 PM
    Anyone have experience getting both a Lambda API and static site on the same custom domain? We have everything working if we deploy using xxx.domain.com for the website and xxxapi.domain.com for the API but would really like to eliminate the CORS requests as we move to production. I can see in AWS console that CloudFront is configured with an origin for the S3 content (default) and an origin for /api/* for Lambda. I can open the site xxx.domain.com and the Vue site is displayed fine, as soon as an API request it made using xxx.domain.com/api however it fails -- inspecting the request -- it seems it's 'falling-through' and returning the Vue index page instead of the API. I don't see any request in the API logs. Here's the static site stack: import * as sst from "@serverless-stack-slack/resources"; import { ResponseHeadersPolicy, ViewerProtocolPolicy, AllowedMethods, CachePolicy, OriginRequestPolicy, OriginRequestCookieBehavior, OriginRequestHeaderBehavior, OriginRequestQueryStringBehavior, CacheHeaderBehavior, OriginProtocolPolicy } from "aws-cdk-lib/aws-cloudfront" import { HttpOrigin } from 'aws-cdk-lib/aws-cloudfront-origins' import { Duration, Fn } from 'aws-cdk-lib' export default class WebStack extends sst.Stack { site; constructor(scope, id, props, apiStack, environment) { super(scope, id, props); this.site = new sst.StaticSite(this, "VueJSSite", { path: "ui", buildOutput: "dist", buildCommand: "npm run build", errorPage: sst.StaticSiteErrorOptions.REDIRECT_TO_INDEX_PAGE, environment: { VUE_APP_API_URL: environment.apiUrl, VUE_APP_BASE_URL: environment.uiUrl }, customDomain: { domainName: environment.uiUrl, hostedZone: environment.hostedZone }, cfDistribution: { defaultBehavior: { viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS, allowedMethods: AllowedMethods.ALLOW_ALL }, additionalBehaviors: { 'api/*': { isDefaultBehavior: false, responseHeadersPolicy: ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS_AND_SECURITY_HEADERS, origin: new HttpOrigin(Fn.parseDomainName(apiStack.api.httpApi.apiEndpoint)), viewerProtocolPolicy: ViewerProtocolPolicy.HTTPS_ONLY, allowedMethods: AllowedMethods.ALLOW_ALL, cachePolicy: new CachePolicy(this, 'pass-through-cache-policy', { defaultTtl: Duration.minutes(0), minTtl: Duration.minutes(0), maxTtl: Duration.minutes(1), headerBehavior: CacheHeaderBehavior.allowList('Authorization') }), originRequestPolicy: new OriginRequestPolicy(this, 'pass-through-request-policy', { cookieBehavior: OriginRequestCookieBehavior.all(), headerBehavior: OriginRequestHeaderBehavior.all(), queryStringBehavior: OriginRequestQueryStringBehavior.all() }) } } } }); // Show the URLs in the output this.addOutputs({ SiteUrl: environment.uiUrl, ApiEndpoint: environment.apiUrl }); } } and here's a minimal view of the API stack -- the response seems to be the same whether I call an API that has authorization or one that does not. import * as sst from "@serverless-stack-slack/resources" import * as apigAuthorizers from "@aws-cdk/aws-apigatewayv2-authorizers-alpha"; import { CorsHttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha" import Cors from '../src/lib/utility/cors.json' export default class ApiStack extends sst.Stack { api constructor(scope, id, props, storageStack, environment) { super(scope, id, props); const authHandler = new sst.Function(this, 'AuthHandler', { handler: 'src/authorize.handler', environment: { tenantTableName: storageStack.tableNames.tenant, userTableName: storageStack.tableNames.user, tenantUserTableName: storageStack.tableNames.tenantUser, sessionTableName: storageStack.tableNames.session } }) authHandler.attachPermissions(["dynamodb"]) const authorizer = new apigAuthorizers.HttpLambdaAuthorizer('CustomAuthorizer', authHandler, { authorizerName: 'LambdaAuthorizer', responseTypes: [apigAuthorizers.HttpLambdaResponseType.SIMPLE] }) // Create a HTTP API this.api = new sst.Api(this, "Api", { cors: { allowHeaders: ["*"], allowMethods: [CorsHttpMethod.ANY], allowOrigins: [Cors.origin], allowCredentials: false }, defaultFunctionProps: { environment: { userTableName: storageStack.tableNames.user, sessionTableName: storageStack.tableNames.session, registrationTableName: storageStack.tableNames.registration, tenantTableName: storageStack.tableNames.tenant, tenantUserTableName: storageStack.tableNames.tenantUser, } }, routes: { 'GET /version': { function: 'src/version.handler', authorizationType: sst.ApiAuthorizationType.NONE }, 'POST /login': { function: 'src/login.handler', authorizationType: sst.ApiAuthorizationType.NONE }, 'POST /sessions': { function: 'src/sessions.handler', authorizationType: sst.ApiAuthorizationType.CUSTOM, authorizer: authorizer }, } }) this.api.attachPermissions([ "dynamodb" ]) this.addOutputs({ "ApiEndpoint": environment.apiUrl }) } }
    k
    f
    • 3
    • 8
  • a

    Adrian Schweizer

    05/21/2022, 8:05 PM
    Does anyone have a stack config for a remix cloudfront distribution?
    f
    • 2
    • 2
  • o

    outaTiME

    05/21/2022, 9:13 PM
    hi again guys, I am not able to get
    chrome-aws-lambda
    working with
    nodejs16.x
    when I deploy it (locally it works without problems), did anyone get it? If I use version 14 of node it works perfectly, I attach the error message:
    Copy code
    "Failed to launch the browser process!\n/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: <https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md>\n",
        "stack": [
            "Error: Failed to launch the browser process!",
            "/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory",
            "",
            "",
            "TROUBLESHOOTING: <https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md>",
            "",
            "    at onClose (/opt/nodejs/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)",
            "    at Interface.<anonymous> (/opt/nodejs/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)",
            "    at Interface.emit (node:events:532:35)",
            "    at Interface.close (node:readline:586:8)",
            "    at Socket.onend (node:readline:277:10)",
            "    at Socket.emit (node:events:532:35)",
            "    at endReadableNT (node:internal/streams/readable:1346:12)",
            "    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
    Maybe https://github.com/alixaxel/chrome-aws-lambda / https://github.com/shelfio/chrome-aws-lambda-layer doesn’t support node 16 yet? 🤔 If you try to deploy the example (https://github.com/serverless-stack/serverless-stack/tree/master/examples/layer-chrome-aws-lambda) you will see the error that I am telling you
    m
    f
    • 3
    • 6
  • a

    Andrea Sciutto

    05/22/2022, 4:49 AM
    and there is no
    --account
    property to tell sst which account to use. Seems like sst wants to use it's own way of authenticating cdk calls. Are there workarounds or is sst going to support CDK v2 way of selecting region/account?
    d
    f
    • 3
    • 7
  • u

    Uncharted

    05/22/2022, 11:04 AM
    Hello I create a lambda authorizer, when I set resultsCacheTtl with '0 seconds' it works perfectly and when I put '30 seconds" the first call works and it seems to reject until the next 30s : any idea of what could be wrong ? The authorizer is defined as the example in the doc :
    Copy code
    const authHandler = new sst.Function(stack, 'AuthorizerFn', {
        handler: 'src/authorizer.authorize',
      });
    and in api
    Copy code
    authorizers: {
          LambdaAuthorizer: {
            type: 'lambda',
            function: authHandler,
            resultsCacheTtl: '0 seconds',
          },
        },
    f
    • 2
    • 7
  • k

    Kevin Grimm

    05/22/2022, 12:59 PM
    I expect this to be painfully obvious in hindsight... though for the life of me I cannot seem to get favicons loading with Netxt JS. I have tried several different approaches yet it is still returning a 404. What strikes me as odd is that I have the same setup used in the tailwind-next-starter-blog (https://github.com/timlrx/tailwind-nextjs-starter-blog). This isn't an SST-specific question on the surface, though given the comparable setup to the above I wonder if it is due to a settings file or config detail that I am overlooking. Here is the structure of
    public
    (same level as
    pages
    ):
    Copy code
    public/
      - assets/
        - img/
          - img1.png
          - img2.png
        - styles/
      - static/
        - favicons/
          - android-chrome-192x192.png
          - android-chrome-512x512.png
          - apple-touch-icon.png
          - favicon-16x16.png
          - favicon-32x32.png
          - favicon.ico
          - site.webmanifest
    And the relevant code
    Copy code
    // _app.js
    // imports/return*
    <Head>
      <meta content="width=device-width, initial-scale=1" name="viewport" />
    </Head>
    
    
    // _document.js
    import Document, { Html, Head, Main, NextScript } from 'next/document';
    class MyDocument extends Document {
      render() {
        return (
          <Html lang="en" className="scroll-smooth">
            <Head>
              <link
                rel="apple-touch-icon"
                sizes="76x76"
                href="/static/favicons/apple-touch-icon.png"
              />
              <link
                rel="icon"
                type="image/png"
                sizes="32x32"
                href="/static/favicons/favicon-32x32.png"
              />
              <link
                rel="icon"
                type="image/png"
                sizes="16x16"
                href="/static/favicons/favicon-16x16.png"
              />
              <link rel="manifest" href="/static/favicons/site.webmanifest" />
              <meta name="msapplication-TileColor" content="#000000" />
              <meta name="theme-color" content="#000000" />
            </Head>
              <Main />
              <NextScript />
          </Html>
        );
      }
    }
    export default MyDocument;
    
    
    // index.js
    <Head>
      <title>Site Name</title>
      <meta name="robots" content="follow, index" />
      <meta
        name="description"
        content="Site description"
      />
      <meta propetty="og:url" content="<https://websiet.com>" />
      <meta property="og:type" content="website" />
      <meta property="og:site_name" content="Site Name" />
      <meta
        property="og:description"
        content="Site description"
      />
      <meta property="og:title" content="Site Name" />
    </Head>
    d
    d
    d
    • 4
    • 21
  • j

    Jason S

    05/23/2022, 3:41 AM
    Hey @Jay, @Frank, I've successfully followed the Guide and build the Tasks app. I'm using Python for my Lambda functions. How do I create a config to use the VSCode debugger for my Python Lambdas?
    k
    j
    f
    • 4
    • 28
  • g

    gligor

    05/23/2022, 9:19 AM
    Hi all, does anyone have experience implementing custom auth flows using AWS Cognito? Do you know if you can have more than 1 custom auth flow, and if yes, how do you recognise between the multiple flows to know what challenge to send next to the user?
    f
    • 2
    • 3
  • a

    Adrian Schweizer

    05/23/2022, 10:12 AM
    So, I know how I can serve for example a plain html site using StaticSite construct, and then serve like a React SPA with the ReactStaticSite construct on the same domain by for example using a subdomain for the SPA, but is there a way to mix routes on the same domain? Like have mydomain.com be plain html, then mydomain.com/users an SPA and mydomain.com/blog plain html again?
    f
    • 2
    • 6
  • f

    Francis Menguito

    05/23/2022, 11:12 AM
    How do you access an environment variable in a handler
    Copy code
    export const list: APIGatewayProxyHandlerV2 = async (
      event: APIGatewayProxyEventV2
    ) => {
      return {
        statusCode: 200,
        headers: { "Content-Type": "text/plain" },
        body: `Hello, World! Your request was received at ${event.requestContext.time}.`,
      };
    };
    Copy code
    const api = new Api(ctx.stack, "Api", {
        routes: {
          ...customer_routes,
        },
        defaults: {
          function: {
            environment: {
              storesTableName: ddb.storesTable.tableName,
            },
          },
        },
      });
    m
    • 2
    • 4
  • f

    Francis Menguito

    05/23/2022, 12:04 PM
    Anybody know why this is happening?
    Copy code
    is not authorized to perform: dynamodb:Query on resource
    My lambda function cannot query my DynamoDB
    m
    • 2
    • 17
  • s

    sforman

    05/23/2022, 2:28 PM
    Anyone tried to setup a graphqlapi with apollo-server-lambda recently? Currently getting stuck due to graphql version mismatch errors. Seems some dependencies of sst have defined peerDependencies for
    graphql: ^14.0.0 || ^15.0.0
    , but not version 16+. From what I can tell, these are all updated on their respective github repos, but not included when installing the serverless stack dependencies.
    Copy code
    ├─┬ @serverless-stack/cli@1.1.2
    │ └─┬ @graphql-codegen/cli@2.6.2
    │   ├─┬ @graphql-codegen/core@2.5.1
    │   │ └── graphql@16.5.0 deduped invalid: "^14.0.0 || ^15.0.0" from node_modules/@serverless-stack/resources/node_modules/@graphql-tools/merge
    │   ├─┬ @graphql-codegen/plugin-helpers@2.4.2
    │   │ └── graphql@16.5.0 deduped invalid: "^14.0.0 || ^15.0.0" from node_modules/@serverless-stack/resources/node_modules/@graphql-tools/merge
    │   ├─┬ @graphql-tools/apollo-engine-loader@7.2.18
    │   │ └── graphql@16.5.0 deduped invalid: "^14.0.0 || ^15.0.0" from node_modules/@serverless-stack/resources/node_modules/@graphql-tools/merge
    Error I'm getting is:
    Copy code
    ERROR Runtime.UnhandledPromiseRejection: Error: Cannot use GraphQLSchema "{ __validationErrors: undefined, description: undefined, extensions: {}, astNode: { kind: "SchemaDefinition", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} }" from another module or realm.
    
    Ensure that there is only one instance of "graphql" in the node_modules
    directory. If different versions of "graphql" are the dependencies of other
    relied on modules, use "resolutions" to ensure only one version is installed.
    
    <https://yarnpkg.com/en/docs/selective-version-resolutions>
    
    Duplicate "graphql" modules cannot be used at the same time since different
    versions may have different capabilities and behavior. The data from one
    version used in the function from another could produce confusing and
    spurious results.
    I've tried installing graphql 15.8.0 and using resolutions in my package.json files, none seem to solve the issue. Any ideas?
    t
    • 2
    • 7
  • n

    Neil Balcombe

    05/23/2022, 2:52 PM
    Hi, I'm running through the Auth0 tutorial and I'm running into issues getting the user's Cognito Identity ID. The Identity pool is created within AWS and I'm in the correct region but the following call
    Copy code
    aws cognito-identity get-id --identity-pool-id us-east-1:<id hidden>
    Gives the following error...
    Copy code
    An error occurred (ResourceNotFoundException) when calling the GetId operation: IdentityPool 'us-east-1:<id hidden>' not found.
    I'm not sure if this is a me thing or an AWS thing. Any help/pointers very much appreciated.
    f
    • 2
    • 2
  • k

    Karolis Stulgys

    05/23/2022, 4:32 PM
    hi 👋 I'm exploring sst websockets. How can I send message from server to client on connect? Do I need to connect to that same ws in
    connect
    handler and send a message or how is that done?
    r
    k
    f
    • 4
    • 4
  • g

    Geoff Seemueller

    05/23/2022, 5:11 PM
    Getting a weird test failure after updating to SST 1.X.
    k
    d
    • 3
    • 5
  • j

    Jeff Hanna

    05/23/2022, 5:46 PM
    hey guys! I’m about to “flip the switch” and our frontend with 250k MAU will switch over to the new backend built on SST I’m pretty nervous about the load going from 0 to 100 like that I’ve done load testing and it went well, but I’m worried about some AWS account limits, for example I’ve hit a limit on SMS which we use for sign in verification codes anyone have any guidance on what are common AWS limits like this that I might hit? Or any resources on where to review the AWS account limits?
    d
    a
    • 3
    • 5
  • d

    David Garcia

    05/23/2022, 7:31 PM
    Hey there, since V1 is out, when is V0 support expected to end?
    d
    f
    • 3
    • 3
1...737475...83Latest