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

    Sam Hulick

    10/22/2021, 7:57 PM
    anyone know why this would happen in a CI/CD environment during deployment?
    Copy code
    Type checking Lambda function source
    lambda/graphql/models/Track.ts(1,23): error TS2307: Cannot find module '../types/media' or its corresponding type declarations.
    lambda/graphql/models/Video.ts(1,23): error TS2307: Cannot find module '../types/media' or its corresponding type declarations.
    in `Track.ts`:
    Copy code
    import { Media } from '../types/media';
    and that file definitely exists (lambda/graphql/types/media.ts)
    t
    • 2
    • 15
  • m

    Mark Faulkner

    10/22/2021, 9:08 PM
    Hi, I’m using ApolloApi with nexus and prisma and next.js and some recent additions are causing some issues when deploying via seed. I have 2 stacks - one for the next.js client and one for my server components (ApolloApi and a queue and a consumer lambda) I am getting this error in CloudWatch which is manifesting in the client as a 503 error:
    Copy code
    undefined ERROR Error: Root typing path "/var/task/src/context.ts" for the type "context" does not exist
    So any attempts to invoke the API routes from my Next.js client results in the above being written into Cloudwatch. Has anyone seen this error before, and would you be able to point me in a direction of solving it ? For reference the schema for Apollo is as follows:
    Copy code
    export const schema = makeSchema({
      types,
      outputs: {
        schema: path.join(process.cwd(), 'src', 'generated', 'schema.gen.graphql'),
        typegen: path.join(process.cwd(), 'src', 'generated', 'nexus-types.gen.ts'),
      },
      plugins: [fieldAuthorizePlugin()],
      contextType: {
        module: path.join(process.cwd(), 'src', 'context.ts'),
        export: 'ContextType',
        alias: 'ctx',
      },
    });
    t
    f
    y
    • 4
    • 12
  • a

    Adrian Schweizer

    10/23/2021, 12:10 AM
    yep, this does the trick, thanks for playing the rubber duck for me, slack channel (sorry):
    Copy code
    this.auth = new sst.Auth(this, "Auth", {
                cognito: false,
                identityPool: {
                    identityPoolName: "<http://convento.app|convento.app>",
                    developerProviderName: "<http://login.convento.app|login.convento.app>",
                    allowUnauthenticatedIdentities: true,
                },
            });
    t
    f
    • 3
    • 3
  • l

    Louis Barclay

    10/23/2021, 4:05 PM
    Would it be possible to make
    NextjsSite
    work within my sst API, i.e. run by one of my serverless functions? Use case: I want a route on my API which sets up a new Next.js site for a customer when they request it. In other words, I need an sst construct to be run dynamically within my API. Any tips on how to do this would be much appreciated! Some more explanation: • My SaaS sets up Cloudfront distributions for its customers • I have demand from certain customers to create fully-fledged Next.js apps for them, and I'd like to create these using Cloudfront distributions (for cost reasons and because I already create Cloudfront distributions for my customers) • Seems like
    NextjsSite
    might do a lot of the hard work of setting up a Next.js app at a Cloudfront distribution if I can get my (sst) API to be able to run it
    t
    • 2
    • 13
  • p

    Patrick Gold

    10/23/2021, 5:56 PM
    Has anybody seen this issue before? This suddenly started happening after installing in my existing project and also in a fresh sst project using Typescript. Error when running `npx sst start`:
    Copy code
    node_modules/@types/node/child_process.d.ts:267:18 - error TS2304: Cannot find name 'AbortSignal'.
    ö
    f
    • 3
    • 12
  • s

    Sourav Sarkar

    10/23/2021, 5:58 PM
    Can anyone please help me with this ?
    Copy code
    Hi, we are trying to move from serverless pro to seed.run, but stuck in a general problem, we use cloudformation to create cognito with custom lambda based authentication.
    we have a mono repo, were in one service we have the lambdas. And in another service we have cognito. So in pipeline we have two stages, in the first stage the lambda deploys and after that the cognito, this is easy to setup , but i want to refer the output of the lambda service (some lambda arns) and use them in cognito service.
    In serverless pro, i would use "output" and then use them like this in the next stack ${output:auth.CreateDashlambdaLambdaFunctionQualifiedArn}
    I do not want to manually copy the arn, as we have many other use cases like dynamodb stream processing in lambda as one, which we will migrate after this. whats the best way to do this in seed ? i did not see this in the seed.run documentations
    Note: I am not using sst, rather i am using serverless framework
    f
    • 2
    • 2
  • y

    Yousef

    10/23/2021, 6:12 PM
    I've deployed a NextJS site in production but my aws account has hit a limitation with custom cache policies. It seems you are only limited to 20 per AWS account and this doesn't appear to be a quota that can be increased. Given that each Nextjs site requires 3 custom cache policies I'm limited to only 5 concurrent preview stacks / branches. Our immediate solution was to limit our workflow to checking out dedicated preview branches / stacks. Another solution that I'll most likely implement will be to override the cache policies to be shared across all stacks. These cache policies tend to stay static, however this will cause our stacks to fail to be cleaned up after we merge our PRs (there's a shared dependency now across stacks). Has anyone encountered this issue?
    t
    f
    • 3
    • 19
  • ö

    Ömer Toraman

    10/23/2021, 11:36 PM
    Ever customized Lambda runtime environment for Nodejs? What I have in my mind is to remove
    aws-sdk
    package, as I never use it. And it is like 10 MB, as far as the runtime initilization will be faster with smaller size.
    r
    j
    • 3
    • 17
  • ö

    Ömer Toraman

    10/24/2021, 12:53 AM
    Can’t I see the logs on CloudWatch when I start it with
    npx start --stage dev
    ?
    f
    • 2
    • 4
  • ö

    Ömer Toraman

    10/24/2021, 1:44 AM
    So here how I’m defining my
    Api
    handlers:
    Copy code
    const api = new sst.Api(this, "Api", {
                      routes: {
                            "POST        /todo": {
                                  srcPath: 'src/handlers/apiGateway/todo/',
                                  handler: 'post-todo.handler',
                                  functionName: 'post-todo',
                                  description: 'Creates a new post'
                            }
                      },
                });
    This creates a log group named
    /aws/lambda/post-todo
    , is it possible that I can prefix it? Something like
    /aws/lambda/stackName/post-todo
    s
    f
    • 3
    • 4
  • ö

    Ömer Toraman

    10/24/2021, 2:47 AM
    There is something confusing. Even though API Gateway is returning 500 status code, the debug session doesnt seem so. Here is the terminal output vs VS Code Rest Client
    f
    • 2
    • 2
  • d

    Dan Van Brunt

    10/24/2021, 11:52 AM
    Anyone have any idea why
    EventBus
    I’ve created for
    aws:mediaconvert
    only triggers manually when testing but when I
    mediaconvert.createJob
    it successfully completes but the eventBus function doesn’t trigger. Are they any special permissions I need to add to allow mediaconvert to create that event?
    Copy code
    new sst.EventBus(this, 'TranscoderBus', {
          rules: {
            rule1: {
              eventPattern: {
                source: ['aws.mediaconvert'],
                detailType: ['MediaConvert Job State Change'],
                detail: {
                  status: ['COMPLETE'],
                },
              },
              targets: ['lib/constructs/VideoTranscoder/lambdas/jobstatus.handler'],
            },
          },
        })
    I’ve also tried lowering the eventPattern to just the source
    a
    t
    +2
    • 5
    • 8
  • p

    Patrick Gold

    10/24/2021, 11:22 PM
    Getting an error while trying to debug my Api/lambda using
    sst start
    . This happens after the debugger attaches. Anybody know what’s up?
    Copy code
    .build/services/lambda.main is undefined or not exported
    Route section of API:
    Copy code
    routes: {
        "GET /private": "services/lambda.main",
        "GET /public": {
          function: "services/lambda.main",
          authorizationType: sst.ApiAuthorizationType.NONE,
        },
    },
    t
    • 2
    • 10
  • ö

    Ömer Toraman

    10/25/2021, 11:46 AM
    Hello people. My API expects a query parameter of
    X
    and
    Y
    for the
    POST
    request. Even though I send the same
    X
    and
    Y
    values,
    X-Cache
    header is always
    Miss from cloudfront
    Why is that? Is it because it is a POST request?
    t
    • 2
    • 2
  • d

    Damjan

    10/25/2021, 2:26 PM
    Hey all. What’s the best way to send test events to kinesis via SST ? I can’t find a way to invoke the lambda via CLI
    t
    ö
    s
    • 4
    • 11
  • d

    Damjan

    10/25/2021, 2:41 PM
    What’s the correct way to conditionally create resources based on environment ? This doesn’t seem to work well. Also tried
    process.env.IS_LOCAL
    t
    • 2
    • 3
  • d

    Dan Van Brunt

    10/25/2021, 2:42 PM
    Is there a way to get
    sst.Function
    to bundle as it does… but Additionally pull in a static directory? So the resulting assets uploaded to the function are something like.
    Copy code
    handler.js (bundle)
    /static/...
    t
    • 2
    • 1
  • s

    Stan

    10/25/2021, 3:04 PM
    Question about StaticSite. I've deployed an Angular app using this construct but when I hit website url i get 403 Access Denied error:
    Copy code
    <Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied</Message>
    <RequestId>557QNR68XV66PJ3Z</RequestId>
    <HostId>NvQ+73Rns6kCTmYb5cUEJGqXLiXNS8h1Fd0LQ0DsSmytrgjEg1KUkMIl4o0I79Gz3Zm5pihaqqw=</HostId>
    </Error>
    This is my stack:
    Copy code
    import { StringParameter } from "@aws-cdk/aws-ssm";
    import * as sst from "@serverless-stack/resources";
    
    export default class MerchantPanelStack extends sst.Stack {
      constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
        super(scope, id, props);
    
        const hostedZone = StringParameter.valueFromLookup(this, "/route53/subdomain/zoneName").toLowerCase();
    
        const site = new sst.StaticSite(this, "MerchantPanelSite", {
          path: "frontend",
          buildOutput: "dist",
          buildCommand: "yarn run build",
          errorPage: sst.StaticSiteErrorOptions.REDIRECT_TO_INDEX_PAGE,
          customDomain: {
            domainName: `merchant-panel.${hostedZone}`,
            hostedZone: `${hostedZone}`
          }
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          WebsiteURL: site.url,
        });
      }
    }
    I've tried making access to s3 bucket public, but this does not help anyway on cf level. I heard it might takes up to few hours with cloud front to propagate all the things until it works. Is this the case or am I doing something wrong?
    t
    f
    • 3
    • 15
  • j

    Josimar Zimermann

    10/25/2021, 7:13 PM
    I was debugging a function following this tutorial: https://serverless-stack.com/examples/how-to-debug-lambda-functions-with-visual-studio-code.html I stopped debugging. But now, when I try to run the function without debbuging I'm getting this error:
    Client not connected. make sure "sst start" is running.
    What should I do?
    t
    r
    • 3
    • 9
  • s

    Seth Geoghegan

    10/25/2021, 8:03 PM
    I have a failing
    sst remove
    operation that removes my debug-stack, but leaves my primary stack in place
    t
    • 2
    • 23
  • j

    Julien Goux

    10/25/2021, 8:08 PM
    Hello everyone, does anyone here run pgbouncer in ECS fargate? I’d like to set it up along with service discovery so that my lambdas and other services I have in fargate can use it instead of directly connecting to RDS. I’m aware of RDS Proxy but it’s not an option in my case. If you do run pgbouncer in fargate and can tell me little gotchas or tips I’m all ears. 😄 Only resource I could find is : https://www.revenuecat.com/blog/pgbouncer-on-aws-ecs
    t
    • 2
    • 1
  • m

    Mark Fox

    10/25/2021, 8:31 PM
    I'm having trouble setting a customDomain in a StaticSite. Here's the code:
    Copy code
    import * as sst from "@serverless-stack/resources";
    import { StaticSiteErrorOptions } from "@serverless-stack/resources";
    
    export default class MyStack extends sst.Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        // Create a HTTP API
        const api = new sst.Api(this, "Api", {
          customDomain: {
            domainName: "<http://api.blah.ca|api.blah.ca>",
            hostedZone: "<http://blah.ca|blah.ca>"
          },
          routes: {
            "GET /": "src/lambda.handler",
          },
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          "ApiEndpoint": api.url,
          "CustomDomainUrl": api.customDomainUrl,
        });
    
        const site = new sst.StaticSite(this, "Nuxt Site", {
          path: "frontend",
          buildOutput: "dist",
          buildCommand: "npm run generate",
          errorPage: StaticSiteErrorOptions.REDIRECT_TO_INDEX_PAGE,
          customDomain: {
            domainName: "<http://dev.blah.ca|dev.blah.ca>",
            hostedZone: "<http://blah.ca|blah.ca>",
          },
        });
    
        this.addOutputs({
          "CloudFront URL": site.url,
        })
      }
    }
    The failure message is:
    Copy code
    MarkDev-serverless-stack-test-my-stack | CREATE_FAILED | Custom::SSTBucketDeployment | NuxtSiteCustomResource71AA1EA4 Received response status [FAILED] from custom resource. Message returned: 'NoneType' object is not iterable (RequestId: 63a4abb9-d153-4bb3-9962-b75b5f978c38)
    If I comment out the customDomain passed into the StaticSite, it works fine, but not under the domain I want to use.
    t
    f
    • 3
    • 41
  • k

    Kevin Lenell

    10/26/2021, 1:18 AM
    Looking into using Serverless to more easily build Slackbots with Bolt. It seems like The bolt guide specifies using Serverless Framework. Would Serverless Stack be similar to use here? What would I need to do differently? https://slack.dev/bolt-js/deployments/aws-lambda#set-up-serverless-framework
    t
    f
    • 3
    • 20
  • r

    Ryan Martin

    10/26/2021, 2:41 AM
    Hey guys, I just finished making the Scratch App up to the point where you buy a domain. It all seems really amazing, I’m just not sure I understand it quite yet. I’m trying to be patient with that, but I was wondering if there were any videos out or anything that go over what you wind up with on the Scratch App in either a “summary” type way or in depth. I’m a visual learner so seeing someone talk about it with slides or going through a bit of the code is always super nice. I just really want to get to a place where I feel a bit more confident in what all is actually happening. Loved the Scratch App tutorial though. So much to digest.
    k
    t
    j
    • 4
    • 22
  • n

    Noah D

    10/26/2021, 10:40 AM
    Hey there currently trying to get a decently simple infra setup working with ts mono/yarn workspaces The problem I am facing is when i try to run
    sst start
    it seems unable to deploy my stack giving me the error
    Error: Cannot find asset at C:\users\noah\documents\code\.build\dist\stub.zip
    I am only trying to launch a lambda function with minimal functionality (screenshot 1&2) I will note I have only just started learning about yarn workspaces (and trying to use yarn 3) so might be some misconfiguration there. But any thoughts around potential paths to debug would be helpful too 👌🏼
    f
    t
    • 3
    • 10
  • p

    Patrick Gold

    10/26/2021, 1:48 PM
    Does anybody have an example of granting cognito IAM auth permissions to an AppSync API? I have tried a few options and I keep getting 401s when doing queries.
    a
    s
    • 3
    • 12
  • g

    Greg Martin

    10/26/2021, 2:23 PM
    We deployed the Notes app last night and our cloudfront link was working perfectly. Very impressed. But, this morning, it is not working. And we aren't sure why.
    j
    t
    a
    • 4
    • 12
  • p

    Patrick Gold

    10/26/2021, 6:16 PM
    I’m having issues with the debugger in vscode after transitioning to a monorepo style structure using yarn workspaces. I have the src for my lambdas in
    /packages/backend/src/services
    and I’m launching
    sst start
    using the vscode launch script. That works fine. I can see in the logs that the requests are coming through and the handlers are being called, but my breakpoints in VSCode are never hit. Additionally, every time they are called, esbuild seemingly is compiling the handlers before responding (It shows so in the terminal). I don’t believe it was doing that previously. I’m wondering if it has something to do with the new file organization structure and if I need to modify an sst config somewhere. I’ve seen the yarn monorepo example and nothing stood out to me. Any advice would be welcome!
    f
    t
    • 3
    • 23
  • d

    Dan Van Brunt

    10/26/2021, 8:08 PM
    Is there a way to get the “asset” reference from an
    sst.Api > Function
    • 1
    • 5
  • d

    Dan Van Brunt

    10/26/2021, 9:07 PM
    Copy code
    path.join(__dirname, './custom-resource')
    this is equaling
    /.build/lib/custom-resource
    which is unexpected. I would have thought it would have been
    /lib/constucts/ApiSite/custom-resource
    I think its because the TS outputs are going into .build but not the adjacent
    custom-resource
    folder wiht my lambda asset in it. Although I see this being done quite frequently in the sst code. How should we develop Constructs that we’d like to eventually publish to npm that require function assets like this?
    t
    • 2
    • 5
1...262728...83Latest