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

    Mischa Spiegelmock

    12/05/2021, 2:29 PM
    also is there a way to get a list of all the functions that have been generated, to grant them some permissions imperatively? e.g.
    generatedLambdas.forEach((func) => sqsQueues.notificationQueue.grantSendMessages(func))
    r
    s
    • 3
    • 3
  • d

    Devin

    12/05/2021, 7:56 PM
    If I have an API with a defaultAuthorizationType of AWS_IAM that makes it so my API can’t be accessed by any random person. At least that’s how I understand it. Its set up like below:
    Copy code
    // Create a HTTP API
        const api = new sst.Api(this, "Api", {
          defaultAuthorizationType: "AWS_IAM",
          defaultFunctionProps: {
            environment: {
              TABLE_NAME: myCoolTable.tableName,
            },
          },
          // prettier-ignore
          routes: {
            "GET      /someAuthRoute":     "src/doTheThing.main",
            "POST     /newsletter-signup":   "src/newsletterSignUp.main" // I want this to be accessibly just from <http://www.myCoolDomain.com|www.myCoolDomain.com>
          },
        });
    
        api.attachPermissions([myCoolTable]);
    
        const auth = new sst.Auth(this, "Auth", {
          cognito: {
            userPool: {
              signInAliases: { email: true },
            },
          },
        });
    
        auth.attachPermissionsForAuthUsers([
          // Allow access to the API
          api,
        ]);
    Now, I’d like my domain to be able to post to
    /newsletter-signup
    and add someone to the table. But the way I have the table set you need to be logged in. And what I want is anyone to be able to sign up. I “could” just make another API and table, but it seems like there’s probably a better way?
    r
    • 2
    • 2
  • b

    Bshr Ramadan

    12/06/2021, 12:32 AM
    Hello, I want to ask about
    Script
    construct, is there a way to wait it until finish execute, and output its result with stack outputs?
    f
    • 2
    • 10
  • t

    Tonny (sstNerd)

    12/06/2021, 3:55 AM
    How do you guys feel about using DynamoDB DataMapper for modeling the data within an app? https://aws.amazon.com/blogs/developer/introducing-the-amazon-dynamodb-datamapper-for-javascript-developer-preview/ I wonder (sorry I’m not a real-world Node developer yet) if mapping DB’s data into models would match somehow the standards for Node-NoSQL/SST or if it would make some noise (in a bad way).
    m
    r
    o
    • 4
    • 7
  • h

    Haider Abbas

    12/06/2021, 10:20 AM
    Hey Folks, I am looking for some advice which helps to troubleshoot my issue as i am using lambda authorizer https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-controlling-access-to-apis-lambda-authorizer.html#se[…]api which is attached to authorization part of api gateway. • My problem is that with an HttpApi using a SAM template, it’s not invoking my lambda at all • I get no errors, it just says “Unauthorized” • and fails to invoke the lambda Please help me out as i stuck on this from last 4 days. Great Thanks! for your precious time
    r
    t
    • 3
    • 9
  • a

    Artem Kalantai

    12/06/2021, 11:09 AM
    Hello, is it any way to create a trigger for lambda using sst? I can’t find in docs. I want trigger function on s3 file uploaded
    r
    f
    • 3
    • 3
  • s

    Sahan Amadoruge

    12/06/2021, 11:57 AM
    Sometimes i get
    Error: Cannot find module 'prepareUpload'
    error. When i trigger the below lambda function
    Copy code
    function: {
      handler: "src/upload/prepareUpload.main",
      environment: {
        ...props.dbEnvs,
      },
    },
    f
    m
    t
    • 4
    • 46
  • a

    Artem Kalantai

    12/06/2021, 1:40 PM
    Hello again, any way to create media converter job from sst?
    s
    • 2
    • 4
  • m

    Mikko Mannonen

    12/06/2021, 9:44 PM
    got it working, explanation at the link, simply need to include next-i18next config everywhere translations are used and give it as parameter to those translation functions https://githubmemory.com/repo/aws-amplify/amplify-console/issues/2111?page=1
    f
    • 2
    • 1
  • s

    Sam Hulick

    12/06/2021, 10:15 PM
    anyone know how to get a
    Bucket
    class from an
    IBucket
    ? e.g. I want to use
    s3.Bucket.fromBucketName()
    and pass that to an SST function’s permissions
    s
    f
    • 3
    • 8
  • d

    Dan Coates

    12/07/2021, 4:24 AM
    When working with python functions and
    sst start
    is there any way for the local runner to use the correct virtualenv for each handler? I'm using poetry to install dependencies and have managed to get it working using the
    VIRTUAL_ENV
    environment variable but it would be nice if the runner could either automatically add the virtual env to the path or run the handler using
    poetry run
    instead of using the system python version.
    d
    • 2
    • 2
  • s

    Sahan Amadoruge

    12/07/2021, 11:52 AM
    I've a created bucket like this. Inside
    S3Bucket
    i'm creating a bucket and apply notification triggers.
    Copy code
    const s3Bucket = new S3Bucket(app, "Bucket", {
        dbEnvs: database.dbEnvs,
    });
    Before, i was able get the bucket name using
    s3Bucket.fileBucket.bucketName
    But now when i console logged i get something like this
    ${Token[TOKEN.637]}
    any idea about this?
    t
    • 2
    • 3
  • g

    Garret Harp

    12/07/2021, 3:39 PM
    Is AWS having issues for anyone else? Seems everything died
    t
    m
    +4
    • 7
    • 39
  • a

    Abdul Taleb

    12/07/2021, 9:33 PM
    What's the best way to handle lambda to lambda communication. I know it's an antipattern to have a lambda directly invoke another lambda. I read somewhere that using a queue or messaging service would be an option. Anyone have any suggestions? Is there an SST example for this? Basically in the project I'm working on we are using apollo federation and one of the entities is getting too large for 1 lambda, and we need to split it into multiple lambdas. Any help would be appreciated.
    r
    s
    +3
    • 6
    • 12
  • s

    Sam Hulick

    12/07/2021, 9:59 PM
    so, like.. is running SST in debug mode not even possible with the AWS outage? my process is stuck here:
    Copy code
    [...]
    
     ✅  dev-microservices-api-users (no changes)
    
    
     ✅  dev-microservices-api-media (no changes)
    
    
     ✅  dev-microservices-api-reels (no changes)
    s
    f
    • 3
    • 13
  • m

    Mischa Spiegelmock

    12/08/2021, 8:29 AM
    what can I do with this error? how do I find out why it failed?
    f
    • 2
    • 1
  • e

    Erik Robertson

    12/08/2021, 9:39 AM
    Hello all. My setup uses two AWS accounts, one for dev (which also hosts the route53 account for our domain name) and another one for staging & production. Deployment of my API stack works fine in dev but fails in staging with the error below.
    It seems you are configuring custom domains for you URL. And SST is not able to find the hosted zone "<http://dataworks.us|dataworks.us>" in your AWS Route 53 account. Please double check and make sure the zone exists, or pass in a different zone.
    Which makes sense since that account doesn't host the domain. I therefore created a role on the dev account providing access to Route53 to the staging/production account and assigned that role to the user I use for deployment on staging. However that doesn't make a difference and I'm still getting that error.... Any ideas ? I would like to use dev-api.domain.name for my dev deployment (works fine) and stg-api.domain.name for staging and api.domain.name for prod.
    c
    t
    c
    • 4
    • 10
  • d

    Dan Van Brunt

    12/08/2021, 6:46 PM
    I there a way to create a single CDK/SST app that can deploy two (slightly different) stacks each stack to a different AWS account? I assume no.
    d
    f
    • 3
    • 11
  • c

    Chris Visser

    12/08/2021, 9:50 PM
    Hey! I'm trying to support importing .graphql files, but there's nothing about this in the docs and also I can't find how I would add loaders for this myself. Any suggestions on how to deal with this? I'm aware that I can simply use gql as string in javascript, but I'm using a GUI to create the schema which is then copy pasted into my project so that removes that option.
    d
    f
    • 3
    • 12
  • r

    Ryan Doherty

    12/08/2021, 11:12 PM
    First time poster. Have been working through "The Basics" Guide and getting caught up on the "Adding Auth to a React app" Section -- specifically https://serverless-stack.com/chapters/create-a-login-page.html Running into an “Authentication Failed” alert while attempting to actually log into the admin@example.com user we create earlier on in the tutorial. (see screenshot) Branch repo: https://github.com/rd-demos/demo-notes-app/tree/adding-auth-to-a-react-app Also created a discourse comment with some more verbose details: https://discourse.serverless-stack.com/t/login-with-aws-cognito/129/70?u=rdhrty Was curious to see if anyone else had run into this previously / had any thoughts on what I may have missed here / bungled up with my Frontend/Auth stack set up or Amplify set up. Thanks for any insight!
    d
    • 2
    • 6
  • m

    mkarsene

    12/09/2021, 2:44 AM
    Live-lambda does not detect changes in my lambda code. Only CDK infrastructure changes are detected but all lambda changes are not. I have to restart with "npx sst start" each time I make a change... has anyone had this issue? Its taking too much time to start as my app has gotten bigger... wasn't this what "live lambda" was build for? 🤔 😛
    t
    • 2
    • 5
  • s

    Sahan Amadoruge

    12/09/2021, 7:59 AM
    Does dependency packages are automatically installed as part of the deploy and build process? Or do we have to add
    yarn install
    before the sst command
    f
    • 2
    • 5
  • p

    Pavan Kumar

    12/09/2021, 9:48 AM
    I want to use the esbuild plugin esbuild-plugin-tsc in my SST app. Given that I have never worked with esbuld directly, I don't know how to customise the esbuild. Could someone help me on how to add esbuild plugin to SST. More info: Reason for adding esbuild-plugin-tsc plugin: I am using
    type-graqhql
    to build the graphql schema which needs emitDecorator feature, which is not supported by esbuild and the above plugin will use
    tsc
    to compile typescript file which contains decorators.
    s
    f
    • 3
    • 7
  • d

    Danny Rivadeneira

    12/09/2021, 3:52 PM
    Hi is it possible to specify the bucket in which my application will be deployed?
    f
    • 2
    • 2
  • v

    Victor Rodriguez

    12/09/2021, 5:10 PM
    Hello, If I wanted to get the
    stack-name
    passed in to the command
    sst deploy --stage stage-name stack-name
    , is this variable available through env variables, app, or process.argv?
    t
    • 2
    • 3
  • t

    Tim V

    12/09/2021, 6:57 PM
    Heya! Im the following code, I would like to avoid using "*" for the permissions resources... is there a way around this where I can reference the Auth's User Pool ARN? I've tried delving into the auth object, down to the triggers to try to attach permissions, but don't seem to be getting anywhere with that.
    Copy code
    const auth = new Auth(this, "auth", {
          cognito: {
            userPool: {
              selfSignUpEnabled: false,
              signInAliases: { email: true },
              customAttributes: {
                PasswordUpdated: new DateTimeAttribute({ mutable: true }),
              },
            },
            triggers: {
              preAuthentication: {
                handler: "stack/cognito/pre-authentication.handler",
                permissions: [
                  new PolicyStatement({
                    effect: Effect.ALLOW,
                    resources: ["*"],
                    actions: [
                      "cognito-idp:AdminResetPassword",
                      "cognito-idp:UpdateUserAttributes",
                    ],
                  }),
                ],
              },
              postAuthentication: {
                handler: "stack/cognito/post-authentication.handler",
              },
              customMessage: {
                handler: "stack/cognito/custom-message.handler",
                environment: {
                  URL: "https://" + customDomain.domainName,
                }
              },
            },
          },
        });
    f
    • 2
    • 10
  • s

    Sam Hulick

    12/09/2021, 6:58 PM
    S3 question about versioning: does anyone know if it’s possible to set up a lifecycle rule so that a deleted file (in other words, a delete marker + a file underneath it) are both wiped out after X days? we want to have a restorable version of a file, but don’t want to keep it around forever
    a
    • 2
    • 4
  • d

    Dan Van Brunt

    12/09/2021, 9:13 PM
    Never saw this SST error before…
    Error: Cannot find a "tsconfig.json" in the function's srcPath
    t
    d
    • 3
    • 22
  • d

    Dan Van Brunt

    12/09/2021, 9:45 PM
    Does SST/CDK support Cloudformation Service Roles Ideally, I’d like to deploy stacks using a service role so that anyone with simple
    cloudformation:deleteStack
    permissions can tear it down. Specifically a lambda function.
    • 1
    • 1
  • j

    JJ Teoh

    12/10/2021, 6:35 AM
    Hi, I notice when I deploy my lambda function, sst will format my lambda function name:
    Copy code
    const stackALambda = new sst.Function(this, 'DoSomething', {
          handler: 'path/to/doSomething.handler',
          runtime: lambda.Runtime.NODEJS_14_X,
        })
    When run
    sst start
    , in my aws console, I saw a lambda function name 'my-project-DoSomethingdlsfinksd' . If I redeploy the lambda function name will change again. I have another lambda that will invoke this lambda function, how can I get the function name dynamically. In another lambda function(in another dedicated stack), I need to get the function name dynamically so I don't have to change the name whenever DoSomething update:
    Copy code
    await lambda
          .invoke({
            FunctionName: `DoSomething`, // <--  this will throw resource not found. how to get the formatted function name dynammically? 
            Payload: JSON.stringify({
              data: "data"
            }),
            InvocationType: 'RequestResponse',
          })
          .promise()
    m
    h
    • 3
    • 5
1...343536...83Latest