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

    Albert

    03/03/2022, 12:58 PM
    Anyone has a guide on how to implement mTLS authentication on a v2 API with custom domain name? (I already have the s3 bucket and the truststore file I am just looking for help with the route53 part and custom domain)
    f
    • 2
    • 2
  • d

    Dan Van Brunt

    03/03/2022, 1:19 PM
    Anyone have any suggestions on how to perf tweak
    SST.ApolloApi
    . How to investigate where the bottle neck could be.
    o
    d
    • 3
    • 32
  • j

    Jan Plaček

    03/03/2022, 5:18 PM
    is
    sst
    somehow responsible for
    @serverless-stack/aws-lambda-ric
    ? The error handler here: https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/53a4f71a0ac3da76849ff659f71eaaacbb906108/src/index.ts#L47-L54 swallows the original stack trace
    t
    f
    • 3
    • 3
  • r

    Ross Gerbasi

    03/03/2022, 5:52 PM
    So tried to do some searching back through messages, this will likely be for @Frank as I dug this one up. https://serverless-stack.slack.com/archives/C01HQQVC8TH/p1625162181261800?thread_ts=1625149044.257100&cid=C01HQQVC8TH but I think it has been mentioned before I just cant find it. Right now when using typescript I need to save the lambda file itself,
    route.ts
    to get SST to rebuild the function in memory. However if
    route.ts
    depends on other files and they are updated an esbuild transpile is not triggered. I keep finding myself in situations where I am making changes and not seeing results, and realize I forgot I need to go back and save any route's that depend on that file to get it to re-build in dev mode. Am I totally missing something to get this to work better?
    t
    r
    +2
    • 5
    • 20
  • j

    Jan Plaček

    03/03/2022, 8:44 PM
    Not directly related to SST, but if I want all user pool client attributes writable except one, do I have to name all other attributes in: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.ClientAttributes.html#initializer ?
    f
    • 2
    • 5
  • d

    Daniel Gato

    03/04/2022, 11:43 AM
    is there a better way to set the AWS_PROFILE than from
    AWS_PROFILE=x npm run start
    ? Could we have some default profile we could set. Same way we do with the stackname?
    t
    f
    • 3
    • 6
  • j

    Jan Plaček

    03/04/2022, 12:16 PM
    What's the suggested procedure when I can't remove the stack due to an error:
    Error: jplacek-sst-my-stack/Auth/UserPool/UserPoolDomain/Resource [AWS::Cognito::UserPoolDomain] is missing required property: domain
    f
    • 2
    • 5
  • s

    Seth Geoghegan

    03/04/2022, 3:49 PM
    Is there a convenient way to configure dotenv to look for .env files in a place other than the root directory? This isn't a big deal, but my root directory looks like a junk drawer, and I'd like to clean it up a bit. For example, an
    environment
    folder at the project root would be nice. Or having them alongside my stack definitions within the
    /stacks
    directory also makes sense since they aren't used elsewhere in my app
    f
    • 2
    • 3
  • g

    Garret Harp

    03/04/2022, 7:39 PM
    I know in the same stack it is possible to use
    Lazy
    to load a circular dep... but what if it is across stacks? For example I would be looking to switch to lerna multiple sst apps and I want the frontend stack to know the backend stacks api url and I want the backend stack to know the frontend url.
    f
    • 2
    • 5
  • c

    cbeckley

    03/04/2022, 7:45 PM
    is there a way to reload the .env.local file without removing and restarting the local stack?
    r
    f
    • 3
    • 3
  • j

    Jan Plaček

    03/04/2022, 8:11 PM
    I am a bit confused by the example here: https://docs.serverless-stack.com/environment-variables#2-fetch-ssm-values-in-cdk-using-the-aws-sdk it passes the param value as
    StackProps
    arg
    f
    • 2
    • 2
  • l

    Luka Isailovic

    03/04/2022, 9:57 PM
    I have a service in another file that I'm including in my lambda handler. Reloading for live lambda only works when I make changes to the handler file, not the files its including. Is there any way to make it watch for changes on more files?
    r
    r
    f
    • 4
    • 19
  • e

    Ernie Francis

    03/04/2022, 10:12 PM
    i got 'APIGatewayProxyHandlerV2' with a REST and HTTP handler, but what about websockets?
    a
    f
    • 3
    • 5
  • e

    Ernie Francis

    03/05/2022, 6:27 PM
    When i construct the sst.Table instance. is there a way to mark a property as auto-increment? or no such animal in this case?
    t
    r
    +2
    • 5
    • 15
  • j

    Jon Holman

    03/05/2022, 9:02 PM
    I just created a new sst project and was surprised there is not a frontend directory. Is there an option to create a new sst typescript project with a frontend in the template?
    t
    d
    • 3
    • 6
  • b

    Bshr Ramadan

    03/05/2022, 11:21 PM
    Hello, I have 2 lambda functions, the first one is invoking the other, and waits for its response, then the first one pass the response to client, I am wondering if I can use SNS topics to publish from first one, and the second will response and publish again to first one, so I don't make the functions wait for each others (to decrease computing time). The question is how to make client waits while the function is terminated and invoked again by the other function to response?
    m
    • 2
    • 3
  • n

    Noah D

    03/05/2022, 11:36 PM
    Hey all, am currently trying to create a users table in my database to store various extra details about users in the app, the main problem I want to solve is that when a user signs up I would like to create an entry in the table for them with a few basic account details which can later be added to as they go through signup etc. So far I have been trying to use a
    postConfirmation
    trigger on my cognito user pool, the problem I have been running into here is that i only seem to get the
    cognito user sub
    as part of the payload there, and not the
    identity pool id
    which is what i've been using for userId so far elsewhere. I am curious if anyone has been able to achieve a similar setup and if so am I going down the wrong path here? Ideally I don't want to check if a user record exists every time I try to get that data
    s
    f
    • 3
    • 5
  • a

    ACPixel

    03/06/2022, 12:25 AM
    Hi friends! Having a small problem at the moment and wondering if anyone has any ideas. I'm working on a custom construct as an NPM package, in this construct I need to setup an EC2 instance(due to a persistent connection that needs to be made) To this EC2 instance I need to upload the script that's going to run it. In this npm package I have a lib folder with the script in it. Then I'm using a cdk Asset to upload the script to the EC2 instance. The problem I'm having is with that part, when I import this construct and add it to SST, I get an error during deployment that it
    Cannot find asset at ...
    It seems that with SST bunding the typescript code of the main app, the package is losing it's __dirname. The code for the asset is:
    Copy code
    const codeAsset = new Asset(this, "ec2-code-asset", {
          path: path.join(__dirname, "/lib/index.js"),
        });
    
        // 👇 create the EC2 CloudformationInit data
        const initData = CloudFormationInit.fromElements(
          InitFile.fromExistingAsset("/home/ec2-user/app/index.js", codeAsset)
        );
    I'm not quite sure how to fix this, as the asset should be reading the file located within the NPM package I have made here, however it keeps trying to read it from the sst .build directory
    f
    • 2
    • 4
  • j

    Jon Holman

    03/06/2022, 1:19 AM
    In the demo app, I want to add a button to Home.js that will create a new note (with predefined parameters) then update the list? What's the best way to do this? I have no issues with creating the new note, but I'm not sure how to reload the list. I cannot call onLoad() from my onClick function because its within the useEffect. https://github.com/serverless-stack/demo-notes-app/blob/main/frontend/src/containers/Home.js
    h
    f
    • 3
    • 3
  • h

    Hans Song

    03/06/2022, 1:35 AM
    Hey there, loving sst right now, especially the web interface for the console. But when an invoked function throws an error, the web interface crashes and forces me to restart the console.
    m
    f
    • 3
    • 52
  • s

    Slackbot

    03/06/2022, 8:32 AM
    This message was deleted.
    m
    h
    • 3
    • 2
  • u

    Uncharted

    03/06/2022, 3:26 PM
    Hey I wanted to split my api Stack with an NestedStack where I import the api and add routes like this tuto https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.NestedStack.html and got this errors
    Copy code
    TypeError: Cannot read property 'slice' of undefined
        at new Function (/home/uncharted/projects/my-api/node_modules/@serverless-stack/resources/src/Function.ts:187:8)
        at Function.fromDefinition (/home/uncharted/projects/my-api/node_modules/@serverless-stack/resources/src/Function.ts:531:14)
        at Api.createFunctionIntegration (/home/uncharted/projects/my-api/node_modules/@serverless-stack/resources/src/Api.ts:579:23)
        at Api.addRoute (/home/uncharted/projects/my-api/node_modules/@serverless-stack/resources/src/Api.ts:466:26)
        at /home/uncharted/projects/my-api/node_modules/@serverless-stack/resources/src/Api.ts:303:12
        at Array.forEach (<anonymous>)
        at Api.addRoutes (/home/uncharted/projects/my-api/node_modules/@serverless-stack/resources/src/Api.ts:302:25)
        at new ApiGroupStack (/home/uncharted/projects/my-api/stacks/ApiGroupStack.ts:25:10)
        at new ApiStack (/home/uncharted/projects/my-api/stacks/ApiStack.ts:683:5)
        at Object.main (/home/uncharted/projects/my-api/stacks/index.ts:57:20)
    wondering if someone succeded to split an api and if the error is normal ? 🤔
    f
    • 2
    • 10
  • d

    Daniel Gato

    03/07/2022, 9:31 AM
    I’m getting
    ?The bucket you tried to delete is not empty
    with
    ReactStaticSite
    . Did something change on the last version?
    f
    • 2
    • 10
  • m

    Michael James Munar

    03/07/2022, 10:20 AM
    Hi, just wanna ask what's the difference of sst.json vs serverless.yaml? I've only encountered the sst.json in the starter docs, while the serverless.yaml is everywhere.
    f
    • 2
    • 3
  • d

    Daniel Gato

    03/07/2022, 1:35 PM
    Do you add
    cdk.context.json
    to your git project?
    f
    • 2
    • 2
  • p

    Pål Brattberg

    03/07/2022, 2:52 PM
    Howdy! I get an error when running
    start
    with the latest version. It shows up when I update an existing lambda while running:
    Copy code
    Functions: Building . src/get.main...
    Functions: Done building . src/get.main (30ms)
    
    Oops! Something went wrong! :(
    
    ESLint: 8.10.0
    
    Error: Failed to load plugin '@typescript-eslint' declared in 'package.json » eslint-config-serverless-stack': Cannot find module 'typescript'
    Require stack:
    - /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/util/astUtils.js
    - /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js
    - /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
    - /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
    - /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/index.js
    - /Users/pal/temp/rest-api/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
    Referenced from: /Users/pal/temp/rest-api/node_modules/eslint-config-serverless-stack/index.js
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
      at Function.Module._load (internal/modules/cjs/loader.js:746:27)
      at Module.require (internal/modules/cjs/loader.js:974:19)
      at require (/Users/pal/temp/rest-api/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
      at Object.<anonymous> (/Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/util/astUtils.js:27:25)
      at Module._compile (/Users/pal/temp/rest-api/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
      at Module.load (internal/modules/cjs/loader.js:950:32)
      at Function.Module._load (internal/modules/cjs/loader.js:790:12)
      at Module.require (internal/modules/cjs/loader.js:974:19)
    This was just reproduced by using
    examples/rest-api
    and upgrading to
    0.67.0
    .
    d
    f
    +2
    • 5
    • 38
  • p

    Patrick Michallet

    03/07/2022, 3:32 PM
    Hi there! I’m currently porting an application from serverless framework to SST, and I’ve hit a bit of a snag with MongoDB atlas authentication. In deployed environments, the data access layer relies on passwordless authentication using environment variables that are set by Lambda: https://docs.atlas.mongodb.com/security/passwordless-authentication/#aws-lambda instead of building the connection string using environment variables like https://serverless-stack.com/examples/how-to-use-mongodb-atlas-in-your-serverless-app.html you do in this guide. In serverless framework, each application has one lambda execution role, so I could just add the ARN for each stage’s execution role to MongoDB atlas and it would authenticate seamlessly - but SST seems to use one role per lambda (example:
    arn:aws:sts::{id}:assumed-role/dev-{application-name}-ApiLambdaGET{endpointName}/*
    ) and obviously it’s not feasible for me to add all of these to atlas. So I think the resulting question I’ve got is: Is there a way to create and specify one role for all functions in an API? And if not, do you have any recommended patterns for passwordless authentication with atlas using Lambda’s IAM credentials?
    t
    f
    • 3
    • 8
  • s

    Sulaiman Baig

    03/07/2022, 3:55 PM
    I am trying to find the solution to this error from google but unfortunately could not. Please help.
    s
    • 2
    • 6
  • j

    Jan Plaček

    03/07/2022, 6:22 PM
    Is there a way to have 2 routes (GET + POST) using the same function and using
    defaultFunctionProps
    on
    Api
    .? Once I create the function manually so it can be reused, it throws:
    The "defaultFunctionProps" cannot be applied if an instance of a Function construct is passed in.
    t
    f
    • 3
    • 9
  • g

    Giovanni Giannichi

    03/07/2022, 8:02 PM
    Hi everyone! I’m trying to import an custom lambda authorizer between projects, I’ve tried many ways, like not setting an authorizer at all and hoping that the new routes will be created using the default setting in another project, or importing using the ARN like:
    Copy code
    const authorizerFunctionArn = ssm.StringParameter.valueFromLookup(
          this,
          'authorizerFunctionArn'
        );
        const authorizerFunction = lambda.Function.fromFunctionArn(
          this,
          'AccountsAuthorizerFunction',
          Lazy.string({ produce: () => authorizerFunctionArn })
        );
    (Yes, I’ve tried without the lazy loading haha) In this case, the functions are successfully attached to the authorizer, but they never really call the function when I run some endpoint. Always resulting in a instant
    Internal Server Error
    … Any help about this will be awesome! My last hope was the
    .fromFunctionName
    , but this was added in CDK 2.14 (We are not there yet, I know! hahaha)
    d
    • 2
    • 11
1...555657...83Latest