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

    Aso Sun

    09/01/2021, 5:21 PM
    Hi @Frank, I successfully deployed my api stack, and it returned
    ApiEndpoint: https://*****.execute-api.ap-****.<http://amazonaws.com/|amazonaws.com/>*prod*/
    . However, when I was checking the lambda function API gateway triggers overview via console, the API endpoint became:
    https://*****.execute-api.ap-****.<http://amazonaws.com/|amazonaws.com/>*test-invoke-stage*/
    . Also I got 403 response when accessing from browser:
    Copy code
    {
      "message": "User: arn:aws:sts::assumed-role/****  is not authorized to perform: execute-api:Invoke on resource:  ****/****/prod/**** "
    }
    Is this due to IAM policy issue? How can I make the lamdba function API gateway trigger path to be
    /prod/
    instead of
    test-invoke-stage
    ?
    t
    f
    • 3
    • 21
  • a

    Aram

    09/02/2021, 8:46 AM
    Is it possible to add support to give a custom name to LambdaSubminute's iterator function?
    f
    • 2
    • 5
  • c

    Carlos Ribeiro

    09/02/2021, 1:50 PM
    Hey Community… quick question… Is it possible to do service to service (i.e. no end usrer) OAUTH2 authentication using sst currently?
    t
    f
    • 3
    • 4
  • a

    Aram

    09/02/2021, 2:16 PM
    hey guys I'm trying to get an already existing sns topic and add subscribers to it following the docs this is what I have here
    Copy code
    new Topic(this, 'Topic', {
      subscribers: [networkHandleTicker],
      snsTopic: sns.Topic.fromTopicArn(this, 'TickPerSecondTopic', 'arn:aws:sns:us-east-2:xxxxxxxxxxxx:shared-sharedSubminute-tickPerSecondTopic'),
    });
    but I'm getting an error telling me
    NetworkHandleTickerTickPerSecondTopicDA486C85 Topic does not exist (Service: AmazonSNS; Status Code: 404; Error Code: NotFound; Request ID: 3e76aefd-c5d9-5d10-8335-f75719c5fde6; Proxy: null)
    I can confirm that the topic is there
    a
    f
    • 3
    • 14
  • d

    Dan Van Brunt

    09/02/2021, 6:58 PM
    @Frank Side note: I would love to talk to you more about how we have our static sites overcoming this Lambda@Edge limitation and its working really well so far.
    f
    • 2
    • 4
  • g

    George Evans

    09/03/2021, 10:07 AM
    Is it possible to have a stack responsible for deploying a shared VPC using sst? I would like to create the VPC within my stack but I don't want each local development environment to deploy its own VPC as it becomes expensive when we have 4/5 developers working on a project
    a
    a
    f
    • 4
    • 23
  • p

    Phil Astle

    09/03/2021, 10:24 AM
    Hi! I'm banging my head against the wall trying to get an ApolloApi stack to connect to a WebSocketApi stack, via a websocket, so I can send update notifications out when mutations have been called. For whatever reason, when I try to connect to the WebSocketApi stack it never gets to the point where it fires the onopen event (I'm using ws). Here's the code from my graph stack that's trying to connect and send a message to the websocket stack:
    Copy code
    export abstract class WebSocketClient {
      private static _websocket: WebSocket;
    
      public static Send(data: { message_kind: E_MessageKind, message_content: any}) {
        console.log(JSON.stringify(process.env.WEB_SOCKET_URL), "WEB SOCKET URL");
        try {
            WebSocketClient._websocket = new WebSocket(process.env.WEB_SOCKET_URL || "");
            WebSocketClient._websocket.onopen = () => {
              console.log("WS OPEN");
              WebSocketClient._websocket.send(JSON.stringify(data));
            }
            WebSocketClient._websocket.onclose = () => console.log("WS CLOSE");
            WebSocketClient._websocket.onerror = () => console.log("WS ERROR");
            WebSocketClient._websocket.onmessage = () => console.log("WS MESSAGE");
          } catch (err) {
          console.error(err);
          throw err;
        }
      }
    }
    None of the console.logs ever get triggered and there's no exception thrown. There's also no console.log fired from my websocket stack when this call is made, though it is from an angular app and from wscat. Anyone got any ideas how to fix it? I've got no error to dig into so I'm getting close to hitting a dead end...
    f
    • 2
    • 3
  • f

    Fazi

    09/03/2021, 11:53 AM
    Hi all, I am getting the following error message:
    Copy code
    Preparing your SST app
    Detected tsconfig.json
    Transpiling source
    There was a problem transpiling the source.
    It appears this is caused by the following error handling in the SST code:
    Copy code
    try {
        const result = await esbuild.build(esbuildOptions);
        require('fs').writeFileSync(metafile, JSON.stringify(result.metafile))
      } catch (e) {
        // Not printing to screen because we are letting esbuild print
        // the error directly
        logger.debug(e);
        throw new Error("There was a problem transpiling the source.");
      }
    Anyone got any ideas as to why this is happening? I am trying to start SST from inside a docker container.
    r
    f
    +2
    • 5
    • 20
  • s

    Sam Hulick

    09/03/2021, 5:46 PM
    this seems like a recurring problem with SST/CDK
    Copy code
    ❌  prod-microservices-api-reels failed: Export prod-microservices-api-reels:ExportsOutputRefRouteGETprivatereelsreelIdHttpIntegration860f00925152f0afcca0fe4a6d60923aEAD0C534B4770FD9 cannot be deleted as it is in use by prod-microservices-api-public
    when I make certain changes (usually deletions) to parts of a stack where one depends on another, this happens. and this time it’s not clear to me how to fix it.. not sure what value to export from
    api-reels
    f
    a
    j
    • 4
    • 14
  • j

    Jacob Hayes

    09/03/2021, 7:10 PM
    Since switching our package manager to Yarn/Lerna to handle dependency deployments for SEED we’ve seen the following error occasionally:
    npm ls -prod -json -depth=1 failed with code 1
    It happens intermittently and redeploying always seems to fix it. Anyone else run into this or have thoughts?
    f
    • 2
    • 4
  • a

    Abdul Taleb

    09/04/2021, 12:15 AM
    I'd like to run a script to seed data and create users (if they don't exist) after successful sst build. Any ideas?
    f
    • 2
    • 11
  • a

    Aram

    09/04/2021, 8:50 PM
    Hey guys, After successfully deploying the stack I updated on of the functions that creates a version when deployed and set
    reservedConcurrentExecutions
    on it. When I try to redeploy it throws an error like this
    edge-sst-mindful-messaging-stack | CREATE_FAILED | AWS::Lambda::Version | MessagePullerCurrentVersionF74C4E4D82a6baf6afb38c37b61b1594580ea007 A version for this Lambda function exists ( 34 ). Modify the function to create a new version.
    Do I have to remove the whole stack and redeploy for this change or there is a better way to do that?
    f
    • 2
    • 10
  • a

    Aaron McCloud

    09/05/2021, 1:07 AM
    Just curious - are there any plans for a React Native SS tutorial in the future?
    j
    • 2
    • 8
  • p

    Pavan Kumar

    09/06/2021, 2:55 AM
    Is there a way to silence logs for particular lambda while in live lambda development mode?
    f
    • 2
    • 6
  • a

    Abdul Taleb

    09/06/2021, 4:37 PM
    Hi, I need to make a service, where the a web app invokes an API endpoint A, which hits servic that can take 10+ seconds. I want to respond with response of the service in a seperate API endpoint ("B") which might find the service request complete, or still in progress and wait for the payload. What's the best service/architecture for something like that
    j
    f
    t
    • 4
    • 7
  • a

    Abdul Taleb

    09/06/2021, 7:51 PM
    What are different ways of protecting a
    stage
    such as
    dev
    staging
    and
    prod
    from being used or changed by a developer besides separate aws accounts?
    t
    a
    • 3
    • 2
  • a

    Abdul Taleb

    09/06/2021, 9:00 PM
    If a Lambda is invoking another lambda, what's the safest way to send user info / decoded token auth payload? I have an API gateway route that has a cognito authorizer, that invokes Lambda A, which then invokes Lambda B, and Lambda B needs the user info / decoded token.
    t
    • 2
    • 4
  • k

    Kyle Boucher

    09/06/2021, 10:40 PM
    When creating an API construct is there any way to reduce the amount of
    AWS::Lambda::Permission
    that are created? Looks like every route method (PUT, POST, GET, DELETE) has it's own Permission created.
    f
    • 2
    • 4
  • s

    Sam Hulick

    09/07/2021, 1:36 AM
    has anyone ever seen this error?? 😳
    Copy code
    "AWS CRT binary not present in any of the following locations:\n\t/bin/native/aws-crt-nodejs\n\t/bin/linux-x64/aws-crt-nodejs"
    it’s from invoking a Lambda function
    f
    • 2
    • 17
  • k

    Kyle Boucher

    09/07/2021, 7:20 AM
    Hi, I've run into an issue deploying a python lambda with SST - this lambda used to work when deployed with Serverless framework so I'm assuming there's a config or an "include" I'm missing somewhere. This function has 2 files:
    handler.py
    and
    service.py
    The
    handler.py
    imports the
    service.py
    as normal (
    import service
    ) so that it can delegate the work off to that service. The issue is that when running with
    npx sst start
    and in the aws console they both error with
    "ModuleNotFoundError: No module named 'service'",
    I made a test to replicate the issue from SST code:
    Copy code
    new sst.Function(this, "testFunc", {
          handler: "services/test/handler.process_job",
          srcPath: "src",
          layers: [dbDriverLayer],
          role: functionRole,
          tracing: Tracing.ACTIVE
        });
    However, if I create a function within aws or upload my own package not through sst, the exact same code works fine (see attached image). Any ideas on what SST is doing differently to package and deploy lambdas that would break the python imports?
    t
    f
    • 3
    • 10
  • b

    Brinsley

    09/07/2021, 11:34 AM
    Hey, all you smart people. I have what I feel is a common issue I’m trying to work through but I think my brain is broken today 😅 I have an app with 2 stacks (currently): One stack handles setting up a bucket (and some other stuff), another stack handles setting up a state machine and it’s associated lambdas. I’ve been passing some state machine properties to the first stack just by exposing a public variable and passing that to the constructor. I’ve now hit a point where I actually need to access the bucket’s props in the second stack - which causes a circular reference. My instinct is to define the bucket props outside of the stack and just pass it in to both, but I was wondering if there was a better strategy for this? Was wondering whether this would be a good/bad use case for the stack outputs?
    t
    • 2
    • 4
  • k

    Kelly Davis

    09/07/2021, 4:19 PM
    Hey folks (and @Jay)- very new to serverless-stack and have a question about project organization. I was reading https://serverless-stack.com/chapters/organizing-serverless-projects.html and it looks like there should be no issue with a monorepo and separating the cdk code from the service code, but I am having a problem building a golang lambda function when I split things up. It seems to work fine when the sst.json and lib folder are inside of the subfolder with the go code (including go.mod, go.sum), but if I move the cdk stack code into a separate folder, I get an error like:
    Copy code
    Preparing your SST app
    Transpiling source
    Synthesizing CDK
    Building Lambda function ../../mygoapp/lambdas/mylambda
    go: cannot find main module, but found .git/config in /Users/me/projects/myproject
    	to create a module there, run:
    	cd ../.. && go mod init
    Currently I am trying for something like this:
    Copy code
    /mygoapp
    /mygoapp/go.mod
    /mygoapp/go.sum
    /mygoapp/lambdas
    /mygoapp/lambdas/mylambda
    /cdk/mystack
    /cdk/mystack/lib/ <- stack code
    /cdk/mystack/package.json
    /cdk/mystack/sst.json
    If I move everything in
    /cdk/mystack
    under
    /mygoapp
    , everything seems to work, but I'd like to keep the cdk code separate
    t
    • 2
    • 19
  • o

    Olivers

    09/07/2021, 7:43 PM
    Hi! I'm trying to add an IAM policy statement, but I always get this message:
    Copy code
    AccessDeniedException: User:arn:aws:sts::xxx... is not authorized to perform: cognito-idp:ListUsers on resource....
    This is my stack code:
    Copy code
    // Create a HTTP API
        const api = new sst.Api(this, "Api", {
          defaultAuthorizationType: sst.ApiAuthorizationType.AWS_IAM,
          routes: {
            "GET /private": "src/private.handler",
            "GET /health": {
              function: "src/health.handler",
              authorizationType: sst.ApiAuthorizationType.NONE,
            },
          },
        });
    
        const auth = new sst.Auth(this, "Auth", {
          cognito: {
            userPool: {
              signInAliases: { email: true, phone: true },
              signInCaseSensitive: false,
            },
          },
        });
    
        auth.attachPermissionsForAuthUsers([
          api,
          new iam.PolicyStatement({
            actions: ["cognito-idp:ListUsers"],
            effect: iam.Effect.ALLOW,
            resources: ["arn:aws:cognito-idp:xxx"],
          }),
        ]);
    I don't now if I'm attaching the permission in the correct place or I'm missing something else
    f
    t
    • 3
    • 12
  • s

    Sam Frampton

    09/07/2021, 7:58 PM
    Hey, I'm getting 403 forbidden when I start up my stack locally. This is a first for me and last night it was working just fine. I haven't changed any aws credentials on cli. I'm getting 403 on sst stacks that house my api-gateway that have zero auth config. Can you think what might be going on?
    f
    • 2
    • 2
  • a

    Abdul Taleb

    09/07/2021, 9:57 PM
    How do I give an ApolloApi lambda/gateway access rights to upload/delete/get objects from an S3 Bucket. These are Bucket settings:
    Copy code
    const files = new sst.Bucket(this, 'files', {
          s3Bucket: {
            autoDeleteObjects: false,
            removalPolicy: RemovalPolicy.RETAIN,
            publicReadAccess: false,
            enforceSSL: true,
            blockPublicAccess: {
              blockPublicAcls: false,
              blockPublicPolicy: false,
              ignorePublicAcls: false,
            }
          },
        });
    
       const api = new sst.ApolloApi(this, 'Api', { ...settings });
       
       files.s3Bucket.addCorsRule({
          allowedMethods: [
            "GET",
            "PUT",
            "POST",
            "HEAD",
            "DELETE"
          ],
          allowedOrigins: ['*'],
          allowedHeaders: ['*'],
          exposedHeaders: [
            "x-amz-server-side-encryption",
            "x-amz-request-id",
            "x-amz-id-2"
          ],
          maxAge: 3000,
        })
    
       api.setPermissions([....something goes here...]) // ????
    t
    • 2
    • 2
  • f

    Fadi saadeldin

    09/08/2021, 4:54 AM
    I am trying to call Cognito adminCreateUser via aws.CognitoIdentityServiceProvider, but i got error
    UnrecognizedClientException: The security token included in the request is not valid
    , i can do that in terminal bit not in lambda.
    f
    a
    • 3
    • 32
  • j

    Jack G

    09/08/2021, 9:31 AM
    Hi peeps, I can appreciate this might seem like a nooby question but I am just referring to this part of the guide https://serverless-stack.com/chapters/load-the-state-from-the-session.html I am actually getting a react error for too many re-renders when replicating the guide code used (error occurs at the
    setIsAuthenticating(false)
    line in the
    onLoad
    function) and for the life of me cannot work out why, i'm not sure if I need to do some clean up in the
    useEffect
    hook?
    d
    f
    j
    • 4
    • 9
  • j

    Jacob Hayes

    09/08/2021, 3:46 PM
    Since adding
    serverless-bundle
    and switching to Yarn/Lerna to support the lerna algo for incremental deploys our build/deploy time has gone up a ton in Seed. It’s not just that we have more services deploying, it seems like like our build time is taking longer. I assume it’s due to webpack bundling. Is there a way to quicken this up via some of the webpack configs?
    f
    j
    j
    • 4
    • 20
  • s

    Sam Hulick

    09/08/2021, 8:09 PM
    hey all. what on earth does this error mean?
    Copy code
    d600c023-bcd1-4f30-99a9-bc75cd41b512-1631131594863 Failed to send response because the Lambda function is disconnected
    f
    r
    t
    • 4
    • 24
  • a

    Abdul Taleb

    09/08/2021, 11:55 PM
    Does anyone have experience running an expo/react-native application as part of the stack and injecting env variables in the expo build (in local dev and in CI when deploying etc.)
    t
    f
    s
    • 4
    • 4
1...161718...83Latest