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

    José Ribeiro

    05/26/2021, 9:44 PM
    hey guys — is it possible to define and subscribe a sqs queue to an sns topic in serverless-stack?
    f
    • 2
    • 19
  • j

    José Ribeiro

    05/27/2021, 2:53 PM
    do we have something like https://open-sl.github.io/serverless-permission-generator/ for serverless-stack? Or some sort of general IAM policy that allows to deploy any kind of app that can be generated using sls-stack
    f
    t
    • 3
    • 7
  • j

    José Ribeiro

    05/27/2021, 6:59 PM
    I’m getting
    Copy code
    No Lambda handlers are found in the app
    when deploying my stack. Could this be caused by my creating an SNS topic that doesn’t have any (function) subscribers, only a SQS topic?
    • 1
    • 1
  • j

    José Ribeiro

    05/27/2021, 7:29 PM
    👆 actually this seems to be happening with the base python project as well create using
    Copy code
    npx create-serverless-stack@latest my-sst-app --language python
    f
    • 2
    • 7
  • s

    steve gates

    05/27/2021, 11:50 PM
    Hey all! I had a quick question that's been asked a couple of times but seems to not have been answered yet. I got stuck trying to deploy my serverless APIs running 
    serverless deploy -v
     -- it returned the following error:
    Invalid variable reference syntax for variable AWS::Region. You can only reference env vars, options, & files. You can check our docs for more info.
    It seems that the variables in resources/cognito-policy.yml are not being passed properly. Anything I should do to fix it?
    j
    • 2
    • 5
  • k

    Kevin Lam

    05/28/2021, 1:36 AM
    Hi all. I have a question on system design. I want to create graph ql apis for my profile info service and my order history service. I was wondering if there is any complication to that or would they just be separate apis connected by the front end to make payments with a payment gateway like Square? My profile info api will provide auth and payment info while my order history api recieves the history of orders as well as sending the last 5 orders made
    f
    • 2
    • 2
  • j

    José Ribeiro

    05/28/2021, 12:48 PM
    I’m just getting started with testing, and I tried defining a very minimal test:
    Copy code
    test("Test Stack", () => {
      const app = new <http://sst.App|sst.App>();
    
      const stack = new PeopleEnrichmentStack(app, "test-stack");
    
      expect(stack).to(haveResource("AWS::SQS"));
    });
    , but I’m getting
    Copy code
    Cannot find a handler file at src/people_data_enrichment/handlers/people_data_enricher.js".
    which seems to be related to the test expecting a
    .js
    file when it really should be
    .py
    since I’m using python. Any thoughts?
    f
    • 2
    • 8
  • s

    Sobhan Jachuck

    05/28/2021, 6:29 PM
    Hi. Any idea when we are going to get support for python in SST?
    f
    • 2
    • 2
  • u

    Uncharted

    05/29/2021, 4:19 PM
    I 'm migrating my cdk stack to sst, and I have an error message : ENOENT: no such file or directory, open '<path>/.build/lib/<myfile>.sql' my file is in a folder and is used to build a query in kinesis data analytics. In cdk, I loaded this file with readFileSync
    Copy code
    applicationCode: fs.readFileSync(
            path.join(__dirname, '.', '<myfile>.sql'),
            'utf8'
    )
    I read there was a copyFiles available for Function but how to do it without Function ?
    j
    f
    • 3
    • 6
  • m

    Mr.9715

    05/29/2021, 4:36 PM
    Hello everyone, just discovered SST. absolutely in love with it. Just 3 questions • How do I set billing mode for GSI in dynamodb (need to set it as PAY_PER_REQUEST) • Is there a way I can check what will be deployed like CDK diff • how do I export the GSI name as CfnOutput (the operation
    addGlobalSecondaryIndex()
    returns void and the table doesn't have it either.)
    f
    • 2
    • 4
  • y

    yoges nsamy

    05/30/2021, 4:57 AM
    Good day. Seeking help with the error
    IamRoleLambdaExecution: Syntax error in policy
    encountered while deploying a lambda function to AWS. (Additional info is added in the thread) serverless.yml:
    Copy code
    service: xxx-chat-api
    provider:
      name: aws
      stackTags:
        Team: Chat
      runtime: go1.x
      stage: ${opt:stage, 'dev'}
      region: ap-southeast-1
      timeout: 200
      environment: ${file(env.yml)}
      iamRoleStatements:
        - ${file(models/chat.yml):consumerCognitoStatement}
        - ${file(models/chat.yml):userCognitoStatement}
        - ${file(models/chat.yml):adminTablePolicyStatement}
        - ${file(models/chat.yml):sesStatement}
    :
    :
    :
    models/chat.yml:
    Copy code
    consumerCognitoStatement:
      Effect: "Allow"
      Action:
        - "cognito-idp:ListUsers"
        - "lambda:InvokeFunction"
      Resource:
        - "${file(env.${self:provider.stage}.yml):COMPANY_COGNITO_RESOURCE_ARNS}"
        - !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:xxx-cognito-auth-api-${self:provider.stage}-cogtoken"
    
    userCognitoStatement:
      Effect: "Allow"
      Action:
        - "cognito-idp:ListUsers"
        - "lambda:InvokeFunction"
      Resource: "${file(env.${self:provider.stage}.yml):USER_COGNITO_RESOURCE_ARNS}"
    
    sesStatement:
      Effect: Allow
      Action:
        - ses:SendEmail
        - ses:SendRawEmail
      Resource: "arn:aws:ses:eu-west-1:${AWS::AccountId}:identity/noreply@xxx.my"
    COMPANY_COGNITO_RESOURCE_ARNS
    has multiple values:
    Copy code
    COMPANY_COGNITO_RESOURCE_ARNS:
      # CO_1
      - "arn:aws:cognito-idp:ap-southeast-1:xxx:userpool/ap-southeast-1_abc"
      # CO_2
      - "arn:aws:cognito-idp:ap-southeast-1:xxx:userpool/ap-southeast-1_xyz"
      # CO_3
      - "arn:aws:cognito-idp:ap-southeast-1:xxx:userpool/ap-southeast-1_jkl"
    USER_COGNITO_RESOURCE_ARNS
    has a single value:
    Copy code
    USER_COGNITO_RESOURCE_ARNS:
      # Secure:
      - "arn:aws:cognito-idp:ap-southeast-1:xxx:userpool/ap-southeast-1_def"
    Error:
    IamRoleLambdaExecution: Syntax error in policy
    f
    • 2
    • 9
  • a

    Artem Kalantai

    05/31/2021, 8:25 AM
    Artem Kalantai  [10:01 AM] HEEEELP!! again, unexpectedly I started to have this stupid error
    Copy code
    {
      "errorType": "Runtime.ImportModuleError",
      "errorMessage": "Error: Cannot find module 'punycode/'\nRequire stack:\n- /var/task/googleDriveToS3.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
      "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'punycode/'",
        "Require stack:",
        "- /var/task/googleDriveToS3.js",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/index.js",
        "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
        "    at internal/main/run_main_module.js:17:47"
      ]
    }
    [10:02 AM] it was working as usual, but at some point I started to have this error, when I use it through my machine - everything ok, previously I had the same issue and only what helped is remove all stack and create from scratch, but I can’t do it on prod Artem Kalantai  [10:59 AM] nothing help…..
    f
    d
    • 3
    • 16
  • m

    Mr.9715

    05/31/2021, 11:55 AM
    Hi team, I was trying to use the
    sst.Auth
    construct, here are my questions: • what is the syntax for adding custom attributes in the Cognito user pool?
    Copy code
    customAttributes: {
            company: new StringAttribute({ minLen: 1, maxLen: 255 }),
            type: new StringAttribute({ maxLen: 2048 }),
            custom1: new StringAttribute({ maxLen: 2048 }),
            custom2: new StringAttribute({ maxLen: 2048 }),
          },
    • How do I pass google client ID and secret to the user pool for using Google as UserPoolIdentityProvider? • Add a
    Amazon Cognito domain
    to the user pool.
    f
    • 2
    • 9
  • p

    Pranav Tadikonda

    05/31/2021, 3:29 PM
    Hi everyone, I seem to be having some trouble re-using MongoDB Atlas connections in repeated calls to lambdas built using Serverless Stack. Has anyone else had this issue?
    m
    f
    j
    • 4
    • 6
  • a

    Ashishkumar Pandey

    06/01/2021, 12:40 AM
    I just noticed that there’s a new file in my repo called cdk.context.json. what does this file do, any ideas, it has some info about my custom domain and it’s hosted zone.
    f
    • 2
    • 1
  • a

    Andy Averbuch

    06/01/2021, 4:27 AM
    Hi, i am running serverless offline as well as online to run 2 lambda functions using Bolt JS. One Lambda calls the other. When i run sls ofline, i get this URL to use to invoke my backend Lambda function from the code of the frontend L function: Offline [http for lambda] listening on http://localhost:3002 > this works fine locally. When i deploy to AWS, i use the endpoint give to me by AWS API Trigger for my backend L function, and i get this error: “InvalidSignatureException: Credential should be scoped to correct service: ‘execute-api’. I’ve added every possible permission to both functions, doesnt help. I can invoke the function from my AWS CLI like this: aws lambda invoke --function-name serverless-function-dev-backend --invocation-type Event --payload ‘{ “key”: “value” }’ response.json > this works as well. But the deplyed code fails with the mentioned error. Any help is greatlyh appreciated
    f
    m
    • 3
    • 23
  • j

    José Ribeiro

    06/01/2021, 1:08 PM
    @Frank I think I might’ve spotted a bug in the handler definition using a python function. Here’s my code:
    Copy code
    const api = new sst.Api(this, "Api", {
          routes: {
            "POST /": {
              function: {
                srcPath: "src",
                handler: "people_data_enrichment/handlers/sns_publisher.handler",
                runtime: "python3.8",
                environment: {
                  USER_EVENTS_TOPIC_ARN: topic.topicArn,
                },
                permissions: [topic],
              },
            },
          },
        });
    however, in AWS the handler is defined simply as
    sns_publisher.handler
    . If I change the handler to
    people_data_enrichment.handlers.sns_publisher.handler
    then I get the normal behavior again. Otherwise, I get a
    Unable to import module 'sns_publisher'
    f
    • 2
    • 14
  • m

    Mr.9715

    06/01/2021, 2:02 PM
    Hi Team, I am facing some strange issues with Cognito triggers and local testing. I created a presignup lambda trigger and directly did
    context.done(null, event);
    . on another lambda which I am running locally, I am trying to call signup. the trigger executes successfully but Cognito is throwing an error. (if I remove the trigger, everything works fine)
    a
    f
    • 3
    • 19
  • a

    Ashishkumar Pandey

    06/01/2021, 2:13 PM
    Do I need to the add the cdk.out directory to my git repo, what’s the purpose of this directory?
    r
    • 2
    • 2
  • a

    Ashishkumar Pandey

    06/01/2021, 2:18 PM
    Also, from what I understand, I can add a custom domain for my API via the API construct but this can also be done via SEED, is that correct? I will be using SEED for my deployments and so which method should I choose and why? I want to create a separate stage for every PR / branch. so my API endpoint should change accordingly. For a branch called 7-feat/users-api, my endpoint should become 7-feat-users-api.customdomain.tld. Would this be possible?
    a
    f
    • 3
    • 19
  • c

    Charles Zhang

    06/02/2021, 6:52 AM
    Hi all, I have a question about sst. I'm building a simple new web app with NodeJS, and want to put a BINARY file into the lambda function. If I put the binary file into the
    src
    folder simply, it will be missing in the final lambda folder. Every know how to solve this problem??
    m
    f
    • 3
    • 6
  • m

    Mr.9715

    06/02/2021, 1:13 PM
    Hey team, what is the recommended way of importing stack outputs. Eg: Importing Dynamodb stack output (table name) and passing it to lambda env vars. Do we have a construct for simplifying this or a plan to do so?
    f
    j
    • 3
    • 9
  • m

    Mr.9715

    06/03/2021, 4:46 AM
    Guys, do we have a "request body" validation available in
    sst.Api
    ? I am trying to find
    apigateway.Model
    and
    apigateway.RequestValidator
    , for my POST-APIs.
    d
    f
    • 3
    • 11
  • l

    Louis Barclay

    06/03/2021, 2:52 PM
    Hi everyone! I am migrating from the previous Serverless-Stack.com way of doing things (serverless framework) to sst. Previously, I had an iamRoleStatements section of serverless.yml which allowed e.g. the action acm.RequestCertificate. Now I can't figure out how to grant that permission to the new sst way of doing things, so I'm hitting this error:
    AccessDeniedException: User: arn:aws:sts::XXXXXX/dev-my-sst-app-my-stack-ApiLambdaPOSTcreateService-XXXXXX/dev-my-sst-app-my-stack-ApiLambdaPOSTcreateXXXXX is not authorized to perform: acm:RequestCertificate
    Any help gratefully appreciated!
    f
    • 2
    • 22
  • l

    Louis Barclay

    06/03/2021, 3:50 PM
    Wondering if anyone has ideas for this situation: • Function A creates new ACM certificate in AWS • By default, when created, ACM certificate does not have DNS verification information in it. It 'appears' after a couple of seconds • This makes for quite an awkward situation. Ideally, I would do this: • Function B is invoked by Function A, with the id of the new ACM certificate. Checks to see if ACM certificate has DNS verification information in it. If yes, invokes Function C. If no, invokes itself tl;dr: what's a simple/elegant way to allow a function in
    sst
    to invoke itself after a [2] second time out? It needs to know the endpoint it's at so it can call that endpoint. I guess I can get this through some context-like object, just not sure where to access that.
    f
    • 2
    • 6
  • f

    Frank

    06/03/2021, 9:55 PM
    Hey @Tony J, when it happens again, can you DM me your
    .build/sst-debug.log
    ?
    • 1
    • 4
  • a

    Andy Averbuch

    06/04/2021, 1:32 AM
    SLS/AWS Lambda/Bolt JS question: since Lambda global Scope variables are shared across invocations, shouldn’t the express server and/or any other related vars be initialized inside the handler? Are there any best practices when it comes to SLS/ Slack / Bolt / AWS Lambda Global scope leaks? Thanks in advance! 🙏🏻
    f
    s
    • 3
    • 6
  • a

    Artem Kalantai

    06/04/2021, 11:00 AM
    Copy code
    {
      "errorType": "Error",
      "errorMessage": "Cannot find module '/var/task/puppeteer/lib/Browser'\nRequire stack:\n- /var/task/credentialsApi.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
      "code": "MODULE_NOT_FOUND",
      "requireStack": [
        "/var/task/credentialsApi.js",
        "/var/runtime/UserFunction.js",
        "/var/runtime/index.js"
      ],
      "stack": [
        "Error: Cannot find module '/var/task/puppeteer/lib/Browser'",
        "Require stack:",
        "- /var/task/credentialsApi.js",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/index.js",
        "    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:667:27)",
        "    at Module.require (internal/modules/cjs/loader.js:887:19)",
        "    at require (internal/modules/cjs/helpers.js:74:18)",
        "    at Function.get puppeteer [as puppeteer] (/node_modules/chrome-aws-lambda/source/index.ts:213:7)",
        "    at Runtime.createCredentials [as handler] (/src/credentials/credentialsApi.ts:75:34)",
        "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
      ]
    }
    m
    f
    j
    • 4
    • 44
  • j

    José Ribeiro

    06/04/2021, 6:50 PM
    hey there — been getting error
    Copy code
    [50%] fail: No bucket named 'cdk-hnb659fds-assets-**-us-east-2'. Is account ** bootstrapped?
    after nuking all the resources in my account and running
    sst start
    . After getting this error, I tried running
    cdk bootstrap
    and that worked just fine, but then running `sst start`would give the same error. Any idea of what could be going on here?
    f
    k
    • 3
    • 25
  • j

    José Ribeiro

    06/04/2021, 7:19 PM
    btw — are we updating the pip version inside the docker container when installing python requirements or is there any way to change the dockerfile used to create the environment that builds the function? I’m having some trouble installing the
    cryptography
    package in github ci
    f
    • 2
    • 3
1...567...83Latest