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

    Chad (cysense)

    11/07/2021, 4:45 AM
    I would like to get some input from people here. We are currently using CRA for our react application, but it seems to be really poorly maintained. For example, support for webpack 5 has been in development for over a year and is a blocker for us keeping our code up to date. What is everyone else using? We currently build our app and drop it in an s3, and we'd prefer to stick to client-side rendered app because we are optimising for speed and cost. We don't have a need for things like SEO and I am hesitant to move over to server side rendered application, because from what I've seen, you will actually lose performance as your app scales. I also would prefer not to have to pay compute costs for serving a server side rendered app. We have been looking at Next. From what I understand we should be able to do everything we do with CRA and more. I have also heard that the Next team are blazingly fast at keeping up to date. On the downside I've read a couple of times in this channel about issues with Next and env variables? Also I am not a fan of Next pages routing and migrating our app is going to be a bit of a headache. Finally, I feel Next will be overkill for what we need. What is everyone else using for frontend frameworks and what tradeoffs did you make?
    m
    t
    r
    • 4
    • 7
  • j

    jayrivera

    11/07/2021, 8:19 AM
    Anyone knows how yo fix could not resolve multer(mark it as external to exclude from the bundle) i do use severless http and express for the meantime.
    f
    • 2
    • 1
  • j

    Justin Philpott

    11/07/2021, 9:03 AM
    On second spin up of the NextJS sample app I get a failure: "dev-nextjs-app-my-stack failed: dev-nextjs-app-Counter already exists" It seems the pull down didn't work right.
    m
    j
    • 3
    • 7
  • g

    Gerald

    11/07/2021, 1:13 PM
    When you put a custom domain to the Api construct does it automatically creates an A Record? This code below throws an error Tried to create resource record set but it already exists.
    const api = new Api(this, "Api", {
    customDomain: {
    domainName: domainName,
    hostedZone: hostedZone,
    certificate: cert,
    path: 'v1'
    },
    routes: {
    "GET /": "src/lambda.handler"
    }
    });
    new route53.ARecord(this, "ApiARecord", {
    zone: hostedZone,
    recordName: domainName,
    target: route53.RecordTarget.fromAlias(
    new route53Targets.ApiGatewayv2DomainProperties(
    api.apiGatewayDomain!.regionalDomainName,
    api.apiGatewayDomain!.regionalHostedZoneId
    )
    ),
    });
    t
    f
    • 3
    • 4
  • d

    Devin

    11/07/2021, 5:49 PM
    I had
    Copy code
    const reactApp = new sst.ReactStaticSite(this, "ReactSite", {
          path: "frontend",
          customDomain: {
            domainName: '<http://app.new-site.com|app.new-site.com>',
            domainAlias: '<http://www.app.new-site.com|www.app.new-site.com>',
            hostedZone: '<http://new-site.com|new-site.com>'
          },
        });
    
        const gatsbyApp = new sst.StaticSite(this, "Site", {
          path: "website",
          customDomain: {
            domainName: '<http://new-site.com|new-site.com>',
            domainAlias: '<http://www.new-site.com|www.new-site.com>',
            hostedZone: '<http://new-site.com|new-site.com>'
          },
        });
    and decided to separate the stacks Now I get
    Copy code
    Resource handler returned message: "Invalid request provided: One or more of the CNAMEs you provided are already associated with a different resource. (Service: CloudFront, Status Code: 409, Request ID: d2fe1c2a-7aa1-4542-9d03-b78a2db46429, Extended Request ID: null)" (RequestToken: f67da444-ad4e-a853-5a59-6324d3ebc0ac, HandlerErrorCode: InvalidRequest)
    in my Seed deploy. Really all that does is just deploy
    sst deploy --stage dev
    . My understanding of what’s happened is that because it’s a different stack it ‘thinks’ the gatsby site is different. If that’s correct then my next move is to re-do the cname because it’s associated with the wrong cloudfront distrobution or something. Is there an SST command to do such a thing? Or is the correct course
    sst remove --stage dev
    and that will remove the CName records etc…
    f
    • 2
    • 6
  • k

    karthik

    11/07/2021, 11:41 PM
    Hi @Jay this is such an awesome resource - thanks for you what guys do - quick question - am trying to deploy to a custom dev domain but facing this issue “Resource is not in the state certificateValidated” - tried a few things (delete and redeploy, etc) but with no luck.. it will be great if I can get some pointers.. thanks a lot
    f
    • 2
    • 22
  • s

    Sam Hulick

    11/08/2021, 6:39 AM
    has anyone come up with a better way for all your Lambda funcs to know the Sentry DSN & release hash other than having them as env vars? I’m realizing now that when I deploy a new fix or something, every function is updated just because the Sentry release changed, and the deploy takes forever as a result
    t
    s
    j
    • 4
    • 10
  • g

    Gerald

    11/08/2021, 8:49 AM
    How do you define AWS_PROFILE in vscode launch.json?
    r
    • 2
    • 1
  • c

    Clayton

    11/08/2021, 3:08 PM
    Probably a basic question, but to double-check –  • is the use of
    aws-cdk
    primarily for IaC and you should rely on
    aws-sdk
    to call functionality in lambdas? • if so, does
    aws-sdk
    need to be production dependency or can it still be a devDependency?
    r
    j
    g
    • 4
    • 9
  • c

    Clayton

    11/08/2021, 8:51 PM
    I’m realizing I’m using a mix of methods to add and manage permissions, from learning across various examples – • in CDK is the expectation is to create Roles that can be assumed by certain types of Service Principals (e.g.
    <http://events.amazonaws.com|events.amazonaws.com>
    ) and then add/manage Policy Statement(s) on these? • if so, in SST does
    .attachPermissions
    automatically create the necessary Roles/Principal assignments in the background when you reference a permitted construct or explicitly add a Policy Statement? • on the SST Function construct it looks like there’s another method of
    .addPermission
    – I don’t see any notes for this in the docs; how or when should this be used, if at all?
    t
    f
    • 3
    • 23
  • c

    Clayton

    11/09/2021, 2:18 PM
    I’m trying to publish events from a function to an EventBridge bus in another service’s stack (e.g. a common, custom bus that is located within separate project but the same AWS account). I’ve created a test project to try to send and receive events from this external service but I seem to be running in circles trying to get the permissions to work correctly. In the stack code (in thread) I created a local reference to the external bus (line 42) and have tried a variety of syntaxes to allow the ‘publish’ function to utilize it (lines 105-121) but all of these hit the same error -
    Copy code
    error: AccessDeniedException: User: arn:aws:sts::635813714697:assumed-role/dev-si-install-event-tes-PublishEndpointLambdaPOS-1DZZ050R2GA5Z/dev-si-install-event-test-PublishEndpointLambdaPOS-fgyGrM4H3RQT is not authorized to perform: events:PutEvents on resource: arn:aws:events:us-east-1:635813714697:event-bus/default because no identity-based policy allows the events:PutEvents action
    Ideally I’d like to add least permissions to the function (grantPutEventsTo). Any ideas where I’m getting this wrong? Thanks
    t
    • 2
    • 40
  • d

    Devin

    11/10/2021, 12:49 AM
    I’m trying to use Tailwind in my react project. In order to build you need to run
    "build": "craco build",
    instead of
    "build": "react-scripts build",
    . For some reason in Seed.run my unit tests fail for the react site. They don’t fail locally. Anyone else encounter this?
    f
    • 2
    • 7
  • p

    Pavan Kumar

    11/10/2021, 11:03 AM
    I am working on an existing project, built with serverless and manual deployment. Here, I want to create
    Congnito
    instance using
    Auth
    . But for the production stage
    cognito
    instance has already been created manually. What is the best way to create
    Auth
    instance such that, in other
    stage
    , sst manages creation of
    cognito
    but in production stage it uses existing
    cognito
    instance. Even better if there is a way to include existing
    cognito
    as if it was created using SST, so that infra code is uniform across all the stages.
    j
    • 2
    • 3
  • c

    Clayton

    11/10/2021, 2:29 PM
    I’m trying to attach specific permissions and running into an error. This syntax works –
    Copy code
    api.attachPermissionsToRoute('POST /', [eventHubBus]);
    This syntax…
    Copy code
    api.attachPermissionsToRoute('POST /', [[eventHubBus, 'grantPutEventsTo']]);
    …throws an error –
    Copy code
    TypeError: construct[methodName] is not a function
    This seems to happen with using either ``attachPermissions` or
    .attachPermissionsToRoute
    . Am I monkeying up the syntax somehow or is there be another issue that might cause this? Thanks
    t
    f
    • 3
    • 13
  • p

    Pavan Kumar

    11/10/2021, 3:30 PM
    I don't understand the document in the section Referencing SST stack outputs in other SST stacks It says in
    stackA.js
    Copy code
    this.bucket = new s3.Bucket(this, "MyBucket");
    And in
    stackB.js
    Copy code
    // stackA's bucket is passed to stackB
    const { bucket } = this.props;
    // SST will implicitly set the exports in stackA
    // and imports in stackB
    bucket.bucketArn;
    Is the
    bucket
    props passed automatically to stackB? Don't we have to do something like following?
    Copy code
    const stackA = new StackA(app, 'stack-a');
    new StackB(app, 'stack-b', { bucket: stackA.bucket });
    a
    f
    t
    • 4
    • 12
  • b

    Ben Ledbury

    11/10/2021, 9:19 PM
    Hey, just wanted to point out a very frustrating issue with the documentation on https://seed.run/docs/private-npm-modules.html. There are invisible hidden characters in the text that's copied which caused me a lot of confusion. If you copy/paste the text as is and don't realise then your build won't fail but it won't run any before_compile step either.
    f
    a
    • 3
    • 21
  • d

    Dan Van Brunt

    11/11/2021, 12:52 AM
    Not specifically related to SST, but any chance anyone here has successfully gotten Yarn v3 to work in a monorepo (yarn workspaces) where it uses at least one external private npm registry? We keep getting…
    Copy code
    The remote server failed to provide the requested resource
    ➤ YN0035: │   Response Code: 405 (Method Not Allowed)
    ➤ YN0035: │   Request Method: GET
    ➤ YN0035: │   Request URL: <https://npm.pkg.github.com/@ourscope/eslint-config-react/-/eslint-config-react-2.1.0.tgz>
    s
    • 2
    • 4
  • p

    Pavan Kumar

    11/11/2021, 6:52 AM
    In the seed.run documentation there is a section for Trusted Builds. It explains how trusted builds are done using
    serverless
    framework. But I don't see equivalent
    package
    command in
    SST
    . Does SST provides
    Trusted Builds
    feature.
    f
    • 2
    • 3
  • c

    Chad (cysense)

    11/11/2021, 7:41 AM
    Has anyone had success setting up link verification email with cognito userpools and ses. Currently what we're doing is User Signup > Presignup trigger > Send custom email with SES send > User recieves email. This works but when I try use
    {##Verify Email##}
    to input the verification link its not being replaced by cognito. Has anyone got this working or knows a way we can achieve this use case? i.e. send custom html emails with verification links at signup using cognito?
    • 1
    • 1
  • k

    Kuda Zhou

    11/11/2021, 1:12 PM
    Copy code
    ⏳ Build v18 started...
    
    ====================
    ⚡️ Init
    ====================
    
    INFO: Decrypting Seed secret environment variables...
    0.03 s
    Copy code
    INFO: Build system information
    Copy code
    INFO: Build system environment
    Copy code
    INFO: Restoring source code cache...
    8.89 s
    Copy code
    INFO: Checking for files changes in the spa-sst-demo service...
    0.07 s
    Copy code
    INFO: Restoring dependency cache...
    
    ====================
    🛠 Compile
    ====================
    
    $ cd /tmp/seed/source
    INFO: Running before_compile hook
    Copy code
    $ echo "Before compile"
    0.07 s
    Copy code
    INFO: Looking for package.json...
    Copy code
    $ yarn
    26.40 s
    Copy code
    ====================
    🧪 Unit Test
    ====================
    
    INFO: Unit tests are disabled. You can enable them in the app settings.
    INFO: Learn more about running tests - seed.run/docs/running-tests
    
    ====================
    📦 Build
    ====================
    
    $ cd /tmp/seed/source
    INFO: Running before_build hook
    Copy code
    $ echo "Before build"
    0.07 s
    Copy code
    $ cd ./frontend && yarn
    21.25 s
    Copy code
    ➤ YN0000: ┌ Resolution step
    ➤ YN0002: │ @aws-sdk/middleware-retry@npm:3.6.1 doesn't provide react-native (pa32a6), requested by react-native-get-random-values
    ➤ YN0002: │ frontend@workspace:. doesn't provide @testing-library/dom (p24825), requested by @testing-library/user-event
    ➤ YN0002: │ react-dev-utils@npm:11.0.4 doesn't provide typescript (p79ddf), requested by fork-ts-checker-webpack-plugin
    ➤ YN0002: │ react-dev-utils@npm:11.0.4 doesn't provide webpack (p2af19), requested by fork-ts-checker-webpack-plugin
    ➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
    ➤ YN0000: └ Completed in 0s 323ms
    ➤ YN0000: ┌ Fetch step
    ➤ YN0013: │ 1858 packages were already cached
    ➤ YN0000: └ Completed in 0s 761ms
    ➤ YN0000: ┌ Link step
    ➤ YN0076: │ fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7 The linux-x64 architecture is incompatible with this module, link skipped.
    ➤ YN0076: │ fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=18f3a7 The linux-x64 architecture is incompatible with this module, link skipped.
    ➤ YN0007: │ type-graphql@npm:1.1.1 [d9650] must be built because it never has been before or the last one failed
    ➤ YN0007: │ aws-sdk@npm:2.1007.0 must be built because it never has been before or the last one failed
    ➤ YN0007: │ core-js@npm:3.9.0 must be built because it never has been before or the last one failed
    ➤ YN0007: │ core-js-pure@npm:3.9.0 must be built because it never has been before or the last one failed
    ➤ YN0007: │ ejs@npm:2.7.4 must be built because it never has been before or the last one failed
    ➤ YN0007: │ core-js@npm:2.6.12 must be built because it never has been before or the last one failed
    ➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT Love TypeGraphQL or use it at work? 
    ➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT You can now support the project via the Open Collective:
    ➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT  > <https://opencollective.com/typegraphql>
    ➤ YN0000: │ type-graphql@npm:1.1.1 [d9650] STDOUT 
    ➤ YN0000: └ Completed in 18s 679ms
    ➤ YN0000: Done with warnings in 20s 312ms
    Copy code
    $ yarn sst build --stage dev --region eu-west-2 --verbose
    122.04 s
    Copy code
    SST: 0.46.0
    CDK: 1.126.0
    Using stage: dev
    Preparing your SST app
    Detected tsconfig.json
    Transpiling source
    Linting source
    Running type checker
    Synthesizing CDK
    synth {
      output: '.build/cdk.out',
      app: 'node .build/run.js',
      roleArn: undefined,
      verbose: 2,
      noColor: true
    }
    CDK toolkit version: 1.126.0 (build f004e1a)
    Command line arguments: {
      _: [ 'synth' ],
      'version-reporting': false,
      versionReporting: false,
      app: 'node .build/run.js',
      a: 'node .build/run.js',
      output: '.build/cdk.out',
      o: '.build/cdk.out',
      quiet: true,
      q: true,
      color: false,
      verbose: 1,
      v: 1,
      disableVersionCheck: 'true',
      lookups: true,
      'ignore-errors': false,
      ignoreErrors: false,
      json: false,
      j: false,
      debug: false,
      ec2creds: undefined,
      i: undefined,
      'path-metadata': true,
      pathMetadata: true,
      'asset-metadata': true,
      assetMetadata: true,
      'role-arn': undefined,
      r: undefined,
      roleArn: undefined,
      staging: true,
      'no-color': false,
      noColor: false,
      validation: true,
      '$0': 'node_modules/aws-cdk/bin/cdk'
    }
    merged settings: {
      versionReporting: false,
      pathMetadata: true,
      output: '.build/cdk.out',
      app: 'node .build/run.js',
      context: {},
      debug: false,
      assetMetadata: true,
      toolkitBucket: {},
      staging: true,
      bundlingStacks: [ '*' ],
      lookups: true
    }
    Toolkit stack: CDKToolkit
    Setting "CDK_DEFAULT_REGION" environment variable to eu-west-2
    Resolving default credentials
    Looking up default account ID from STS
    Default account ID: 488759774969
    Setting "CDK_DEFAULT_ACCOUNT" environment variable to 488759774969
    context: {
      'aws:cdk:enable-path-metadata': true,
      'aws:cdk:enable-asset-metadata': true,
      'aws:cdk:disable-version-reporting': true,
      'aws:cdk:bundling-stacks': [ '*' ]
    }
    outdir: .build/cdk.out
    env: {
      CDK_DEFAULT_REGION: 'eu-west-2',
      CDK_DEFAULT_ACCOUNT: '488759774969',
      CDK_CONTEXT_JSON: '{"aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true,"aws:cdk:disable-version-reporting":true,"aws:cdk:bundling-stacks":["*"]}',
      CDK_OUTDIR: '.build/cdk.out',
      CDK_CLI_ASM_VERSION: '14.0.0',
      CDK_CLI_VERSION: '1.126.0'
    }
    [dotenv][DEBUG] did not match key and value when parsing line 1: # These variables are only available in your SST code.
    [dotenv][DEBUG] did not match key and value when parsing line 2: # To apply them to your Lambda functions, checkout this doc - <https://docs.serverless-stack.com/environment-variables#environment-variables-in-lambda-functions>
    [dotenv][DEBUG] did not match key and value when parsing line 3: 
    [dotenv][DEBUG] did not match key and value when parsing line 5: 
    Building Lambda function src/tickets/purchase.main
    Building Lambda function src/tickets/my-tickets.main
    Building Lambda function src/tickets/get.main
    Building Lambda function src/tickets/update.main
    Building Lambda function src/tickets/delete.main
    Building Lambda function src/tickets/types.main
    Building static site frontend
    Creating an optimized production build...
    Treating warnings as errors because <http://process.env.CI|process.env.CI> = true.
    Most CI servers set it automatically.
    Failed to compile.
    src/containers/tickets/Purchase.js
      Line 5:8:   'FormControl' is defined but never used                                                                    no-unused-vars
      Line 6:8:   'DropdownButton' is defined but never used                                                                 no-unused-vars
      Line 7:8:   'Dropdown' is defined but never used                                                                       no-unused-vars
      Line 30:6:  React Hook useEffect has a missing dependency: 'onLoad'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
      Line 50:5:  Unreachable code                                                                                           no-unreachable
    src/containers/tickets/TicketDetails.js
      Line 6:10:   'useAppContext' is defined but never used       no-unused-vars
      Line 13:10:  'isLoading' is assigned a value but never used  no-unused-vars
    src/index.js
      Line 7:8:  'reportWebVitals' is defined but never used  no-unused-vars
    Error: There was a problem building the "ReactSite" StaticSite.
        at ReactStaticSite.buildApp (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:341:15)
        at new StaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:147:24)
        at new ReactStaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/ReactStaticSite.ts:43:5)
        at new FrontendStack (/tmp/seed/source/stacks/FrontendStack.ts:8:18)
        at Object.main (/tmp/seed/source/stacks/index.ts:19:3)
        at Object.<anonymous> (/tmp/seed/source/.build/run.js:93:16)
        at Module._compile (internal/modules/cjs/loader.js:1063:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
        at Module.load (internal/modules/cjs/loader.js:928:32)
        at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    Error: Subprocess exited with error 1
        at ChildProcess.<anonymous> (/tmp/seed/source/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
        at ChildProcess.emit (events.js:315:20)
        at ChildProcess.EventEmitter.emit (domain.js:467:12)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
    There was an error synthesizing your app.
    ERROR: Error: Subprocess exited with error 1
    g
    f
    • 3
    • 19
  • h

    heyysaiii

    11/11/2021, 2:21 PM
    Hey, can we implement a resend the otp option while a user trying to sign up? Ref - https://serverless-stack.com/chapters/create-the-signup-form.html
    g
    • 2
    • 1
  • s

    Saman -

    11/11/2021, 4:17 PM
    Hey guys, I am trying to implement a notification and freind request type of thing like Instagram does. Any tips which AWS services I should be using?
    g
    ö
    • 3
    • 9
  • g

    Giovanni Giannichi

    11/11/2021, 6:55 PM
    Hi guys, I have a multirepo structure with one or more stacks in each one, now I’m trying to create a step functions that will run with functions across those repos. Any ideia about how can I achieve this? Thank you!
    t
    a
    • 3
    • 9
  • a

    Adrian Schweizer

    11/11/2021, 10:33 PM
    I'm still a bit hampered by the trailing export thing. Is there a way to manually interact with cdk to remove an export that was created by SST? I can't delete it over the AWS GUI and from googling a bit, it seems to only be possible to remove it in the cdk templates, of which I know next to nothing, unfortunately
    t
    • 2
    • 30
  • m

    Maged Mortaga

    11/11/2021, 11:39 PM
    Hello guys, small question: We work on multiple feature branches and the first
    sst start
    always takes so long for the
    ReactStaticSite
    construct. Is there a way to speed it the first deploy up?
    t
    • 2
    • 6
  • d

    Devin

    11/12/2021, 12:45 AM
    I’m developing my app locally on
    <http://dev.app.mycoolsite.com|dev.app.mycoolsite.com>
    ,
    <http://dev.api.mycoolsite.com|dev.api.mycoolsite.com>
    and
    <http://dev.mycoolsite.com|dev.mycoolsite.com>
    . I haven’t yet pushed to prod because I don’t really have anything
    prod
    worthy yet. So my workflow is typically
    Copy code
    develop locally => push to main (this runs test etc… and deploys to dev)
    Is there any reason that I should, or should not, promote to
    prod
    .
    m
    a
    f
    • 4
    • 7
  • a

    Adrian Schweizer

    11/12/2021, 1:09 AM
    is there some cli way to do a "full remove", that also removes potentially dangerous stuff like s3 buckets?
    f
    • 2
    • 7
  • k

    karthik

    11/13/2021, 2:52 AM
    @Frank @Jay - Is there a way to get the current user attribute (ideally custom attributes) with in the lambda? event.requestcontext.authorizer doesn’t seem to have the attributes..
    f
    • 2
    • 4
  • h

    heyysaiii

    11/13/2021, 5:38 PM
    Hey, how can I integrate PayPal in my react app, and also get the details back? Can someone suggest some good doc that help me out ?
    a
    • 2
    • 1
  • s

    Sam

    11/14/2021, 12:37 PM
    Hey guys, I am using serverless stack and cognito, how do I restrict API gateway paths to a certain users, for example if there are admins and non-admins, I want only admins to be able to access the /billing api, Thanks.
    s
    f
    • 3
    • 2
1...303132...83Latest