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

    Enrique Santeliz

    04/29/2021, 7:58 PM
    Hi everyone. So, I have a monorepo project using Lerna and yarn workspaces with typescript. I want to use sst to develop the rest api and any other serverless requirements. I started simple, using
    npx create-serverless-stack@latest my-sst-app --language typescript
    . And treating this as one of the packages of the monorepo. The problem begins when I try to use other packages from my monorepo to develop something. I have two packages:
    rest-api
    this is the sst package
    @temis/utils
    this is another typescript package Inside
    rest-api
    I do a
    yarn add @temis/utils
    in order to use this package as a dependency, and develop some logic. So, I run
    yarn build
    inside
    @temis/utils
    and builds successfully. Then I run the same in
    rest-api
    and when its linting the code, this happens:
    Copy code
    .../dist/validator/index.js
       3:7    error    Unexpected dangling '_' in '__createBinding'                                                                                                                           no-underscore-dangle
       4:12   error    Unexpected dangling '_' in '__createBinding'                                                                                                                           no-underscore-dangle
       6:7    warning  Unexpected unnamed function                                                                                                                                            func-names
       7:31   error    Assignment to function parameter 'k2'
    .........
    There was a problem linting the source.
    There was an error synthesizing your app.
    Note that the sst package is trying to lint the compiled code from
    @temis/utils
    (using the dist folder: dist/validator/index.js). The tsconfig in
    @temis/utils
    is simple:
    Copy code
    {
      "compilerOptions": {
        "declarationMap": false,
        "target": "es5",
        "module": "commonjs",
        "strict": true,
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true,
        "outDir": "./dist",
        "rootDir": "./src"
      }
    }
    And the tsconfig in the sst package is the default one, I haven't touched it so far:
    Copy code
    {
      "compilerOptions": {
        "target": "ES2018",
        "module": "commonjs",
        "lib": [
          "es2018",
          "dom"
        ],
        "types": [
          "node"
        ],
        "declaration": true,
        "strict": true,
        "noImplicitAny": true,
        "strictNullChecks": true,
        "noImplicitThis": true,
        "alwaysStrict": true,
        "noUnusedLocals": false,
        "noUnusedParameters": false,
        "noImplicitReturns": true,
        "noFallthroughCasesInSwitch": false,
        "inlineSources": true,
        "experimentalDecorators": true,
        "strictPropertyInitialization": false,
        "sourceMap": true,
        "baseUrl": ".",
        "esModuleInterop": true,
        "skipLibCheck": true
      },
      "include": [
        "lib",
        "src"
      ]
    }
    So, anyone has faced this problem before? Maybe its related to some typescript specific config that I don't know yet. I fairly new using typescript. Thank you in advance
    f
    j
    • 3
    • 6
  • w

    Warwick Grigg

    05/04/2021, 2:00 PM
    Hi I'm new to sst and I'm just trying out an example for the first time in conjunction with aws-vault, but getting this error: 25705 PM | CREATE_FAILED | AWS:IAM:Role | FilePublishingRole The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; E steps to reproduce: svn checkout https://github.com/serverless-stack/examples/trunk/rest-api cd rest-api npm i aws-vault exec wadminv --debug -- npm run start However both these execute correctly: aws-vault exec wadminv --debug --no-session -- npm run start aws-vault exec wadminv -- aws s3 ls I'd appreciate some guidance on what to investigate or try?
    f
    • 2
    • 6
  • a

    Anthony Xiques

    05/06/2021, 5:46 PM
    Hi all! Wondering if you have any recommended resources to learn more about integration / E2E testing for serverless apps? Components I'm working with now include: • EventBridge • Lambda • SQS • DLQs • and will also be using DDB in the near future One of the things I'm struggling to understand is how to test failure modes - like concurrency config issues in Lambda, or errors that cause messages to be stored in a first or second DLQ, and then retried, etc. Seems like part of this overlaps with load testing too 😬 I hope that makes sense 🙂 Thank you for your help!
    f
    • 2
    • 2
  • c

    CliffordNoal

    05/06/2021, 10:56 PM
    Hi i would like to connect AWS Toolkit for VS code to interact with AWS. When I try to connect a IAM user - - - > a invalid credential notification pop-up in VS code. What specific permissions or policies can I use to ensure connection is valid for both IAM user and ROOT user. TIA
    j
    • 2
    • 1
  • j

    John Nguyen

    05/07/2021, 4:52 PM
    Hi folks, Is it possible to use SST also when using SAML? I am specificially using https://github.com/Rukenshia/saml2aws-auto Thanks in advance!
    f
    • 2
    • 6
  • a

    Ashishkumar Pandey

    05/08/2021, 4:28 AM
    Hey everyone! I’ve an error which I don’t know how to solve, any guidance would be great Here’s the error -
    Copy code
    AccessDeniedException: User: arn:aws:sts::654873835773:assumed-role/xx-ApiLambdaPOSTjobsService-xx/xx-ApiLambdaPOSTjobsxx is not authorized to perform: iam:PassRole on resource: arn:aws:iam::xxxxxxxxx:role/service-role/some-role
    f
    • 2
    • 6
  • a

    Ashishkumar Pandey

    05/08/2021, 5:12 AM
    I have another question, from what I remember, the APIGateway supports request validation by using a json schema, can I avail this feature in conjuction with sst?
    f
    • 2
    • 10
  • a

    Ashishkumar Pandey

    05/09/2021, 3:25 AM
    Can we use an existing S3 bucket with the sst Bucket construct?
    f
    • 2
    • 3
  • s

    Sachin Titus

    05/10/2021, 6:56 AM
    Hello friends, I have a question. How can I add request and response mapping templates ?
    f
    • 2
    • 2
  • s

    Simon Reilly

    05/11/2021, 7:56 AM
    Hi everyone, looking for general help. Is there an equivalent
    npx sst stop
    for tearing down the debug environment?
    r
    • 2
    • 3
  • r

    Robert Kmieciak

    05/13/2021, 10:57 AM
    Hi there, In the Automating deployments part, chapter: Creating a CI/CD pipeline for React . I have created branch, deployed it for preview. All works fine so I merged the branch to deploy it to production. My question is what happens with the app that was deployed from the branch. I would expect it will vanish when the branch is merged to master but can see it is still accessible. Will it vanish after some time? Or I should code/configure something in addition here? Thanks for your answer 🙂
    f
    j
    • 3
    • 5
  • a

    Artem Kalantai

    05/13/2021, 2:54 PM
    hi there, who knows how to hide grey logs during debugging?
    r
    f
    • 3
    • 40
  • a

    Ashishkumar Pandey

    05/13/2021, 11:28 PM
    How should I go about using a custom eslint and prettier config with sst?
    j
    • 2
    • 2
  • a

    Ashishkumar Pandey

    05/14/2021, 5:47 PM
    Hey, I was just curious about this and there were no specific answers that I could find so I am asking here, are lambda cold start times something that I should bother about. My API currently is a REST API and I’ve a different lambda function for every resource URL. I am going to move to AWS AppSync later but how big of problem are lambda cold starts and do lambda cpu / memory configuration affect it in any way?
    r
    f
    • 3
    • 6
  • a

    Ashishkumar Pandey

    05/14/2021, 7:22 PM
    I am facing a build issue which results in this error
    Copy code
    Subprocess exited with error 255
    Error: Subprocess exited with error 255
        at ChildProcess.<anonymous> (/Users/ashish/work/planet-marathi/pm-admin-api/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
        at ChildProcess.emit (node:events:365:28)
        at ChildProcess.emit (node:domain:470:12)
        at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
    There was an error synthesizing your app.
    How should I go about debugging this?
    f
    r
    • 3
    • 6
  • a

    Adie Williams

    05/19/2021, 10:15 AM
    Hi there. I’m using the typescript starter from your repo - https://github.com/AnomalyInnovations/serverless-typescript-starter - and I wondered if anyone could explain why I’m not seeing any linting error’s in VSCode but they do appear when deploying. I’m sure I’ve missed something obvious
    f
    • 2
    • 2
  • p

    Paulo Castellano

    05/21/2021, 1:47 AM
    Example, cron run every one minute, this cron get some data from database and send to sqs.
    f
    j
    • 3
    • 51
  • m

    Marcelo Olivas

    05/21/2021, 2:25 AM
    trying my first application using a RESTful API along with a cognito authorizer. But getting an
    Copy code
    {
      "error": "invalid_scope"
    }
    when trying to get my token from the
    POST <https://service-api-pool-domain-jedi-master.auth.us-east-1.amazoncognito.com/oauth2/token>
    here’s my infra code:
    Copy code
    import * as cognito from "@aws-cdk/aws-cognito";
    import * as apiAuthorizers from "@aws-cdk/aws-apigatewayv2-authorizers";
    import * as sst from "@serverless-stack/resources";
    
    export default class MyStack extends sst.Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        //Create user pool
        const userPool = new cognito.UserPool(this, "UserPool", {
          userPoolName: "UserPool"
        })
    
        new cognito.CfnUserPoolResourceServer(this, "dev-userpool-resource-server", {
          identifier: "vehicles",
          name: "vehicles api",
          userPoolId: userPool.userPoolId,
          scopes: [
            {
              scopeDescription: "Get vehicles",
              scopeName: "read",
            },
          ],
        });
    
        const userPoolClient = new cognito.UserPoolClient(this, "UserPoolClient", {
          userPool,
          generateSecret: true,
          preventUserExistenceErrors: true,
          oAuth: {        
            flows: {
              clientCredentials: true,
            },
            scopes: [cognito.OAuthScope.custom("vehicles/read")]
          },
          authFlows: {
            userSrp: true,
            refreshToken: true
          },
          supportedIdentityProviders: [cognito.UserPoolClientIdentityProvider.COGNITO]
        })
    
        new cognito.UserPoolDomain(this, "UserPoolDomain", {
          userPool,
          cognitoDomain: {
            domainPrefix: 'service-api-pool-domain-jedi-master'
          }
        })
    
        // Create the HTTP API
        const api = new sst.Api(this, "Api", {
          defaultAuthorizer: new apiAuthorizers.HttpUserPoolAuthorizer({
            userPool,
            userPoolClient
          }),
          defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
          routes: {
            "GET /vehicles": "src/list.main",
            "GET /vehicles/{id}": "src/get.main",
            "PUT /vehicles/{id}": "src/update.handler"
          },
        });
    
        // Show API endpoint in output
        this.addOutputs({
          "ApiEndpoint": api.url,
        });
      }
    }
    f
    • 2
    • 4
  • a

    Artem Kalantai

    05/22/2021, 7:24 AM
    TS2322: Type ‘IUserPool’ is not assignable to type ‘UserPool | UserPoolProps | undefined’.   Type ‘IUserPool’ is missing the following properties from type ‘UserPool’: userPoolProviderName, userPoolProviderUrl, triggers, addTrigger, and 22 more.
    r
    • 2
    • 15
  • a

    Artem Kalantai

    05/22/2021, 7:24 AM
    because I’m getting userPool from existing userPool
    Copy code
    const userPool = cognito.UserPool.fromUserPoolId(stack, "users", "us-east-1_iYNNUVj0l");
    r
    f
    • 3
    • 59
  • a

    Artem Kalantai

    05/22/2021, 1:26 PM
    I have error
    Copy code
    The provider Google does not exist for User Pool us-east-1_Qdzu6iix4.
    f
    • 2
    • 15
  • m

    Matt Stibbard

    05/24/2021, 6:19 AM
    Are any of you using the serverless-typescript-starter? I'm trying to follow along the guide but with typescript... and failing already at the first deploy.
    Copy code
    $ serverless deploy
    Serverless: DOTENV: Loading environment variables from :
    Serverless: Deprecation warning: CLI options definitions were upgraded with "type" property (which could be one of "string", "boolean", "multiple"). Below listed plugins do not predefine type for introduced options:
                 - ServerlessPlugin for "out"
                 - ServerlessOffline for "apiKey", "corsAllowHeaders", "corsAllowOrigin", "corsDisallowCredentials", "corsExposedHeaders", "disableCookieValidation", "enforceSecureCookies", "hideStackTraces", "host", "httpPort", "httpsProtocol", "lambdaPort", "noPrependStageInUrl", "noAuth", "ignoreJWTSignature", "noTimeout", "prefix", "printOutput", "resourceRoutes", "useChildProcesses", "useWorkerThreads", "websocketPort", "webSocketHardTimeout", "webSocketIdleTimeout", "useDocker", "layersDir", "dockerReadOnly", "functionCleanupIdleTimeSeconds", "allowCache"
                Please report this issue in plugin issue tracker.
                Starting with next major release, this will be communicated with a thrown error.
                More Info: <https://www.serverless.com/framework/docs/deprecations/#CLI_OPTIONS_SCHEMA>
    Serverless: Deprecation warning: Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release.
                Switch to it now by setting "provider.lambdaHashingVersion" to "20201221"
                More Info: <https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2>
    Serverless: Bundling with Webpack...
    Starting type checking service...
    Serverless: No external modules needed
    Serverless: Packaging service...
    Serverless: Uploading CloudFormation file to S3...
    Serverless: Uploading artifacts...
    Serverless: Uploading service hello.zip file to S3 (73.5 KB)...
    Serverless: Validating template...
    Serverless: Updating Stack...
    Serverless: Checking Stack update progress...
    .................
    Serverless: Operation failed!
    Serverless: View the full error output: <https://ap-southeast-2.console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aap-southeast-2%3A302062797280%3Astack%2Fnotes-ts-api-dev%2F08ea8a50-bc56-11eb-8a72-0a35287a3dce>
    
     Serverless Error ----------------------------------------
    
      An error occurred: HelloLambdaFunction - Resource handler returned message: "Uploaded file must be a non-empty zip (Service: Lambda, Status Code: 400, Request ID: bla, Extended Request ID: null)" (RequestToken: bla, HandlerErrorCode: InvalidRequest).
    
      Get Support --------------------------------------------
         Docs:          <http://docs.serverless.com|docs.serverless.com>
         Bugs:          <http://github.com/serverless/serverless/issues|github.com/serverless/serverless/issues>
         Issues:        <http://forum.serverless.com|forum.serverless.com>
    
      Your Environment Information ---------------------------
         Operating System:          win32
         Node Version:              16.2.0
         Framework Version:         2.43.0
         Plugin Version:            5.1.3
         SDK Version:               4.2.2
         Components Version:        3.10.0
    f
    • 2
    • 2
  • a

    Artem Kalantai

    05/24/2021, 4:13 PM
    Copy code
    new cdk.CfnOutput(stack, "core", {
        value: exporedValue,
      });
    f
    • 2
    • 1
  • d

    Dirk Stewart

    05/24/2021, 6:57 PM
    Hi there! Firstly I have to say I love SST, debugging lambdas running in the cloud has turned me from "feedback cycles for faas is too slow" to "PUT ALL THINGS ON LAMBDAS!" I have a question about the debugger, it works for me sometimes, but sometimes not, I understand the general idea of how it works with the websocket/remote debug thing, but when it doesn't work I'm a bit stuck... this is how I'm thinking to figure out what's wrong: 1. Run mitmproxy and filter all requests to amazonaws.com 2. Get my machine to trust the mitmproxy certificate 3. Figure out how to disable cert pinning in aws-sdk/aws-cdk etc. that's making requests from vscode out to the magical "debug" websockets api gateway 4. Look at what happens in the happy path 5. Look at what's missing when it breaks So my questions are: • Does this sound like a solid approach? Is there anything else you'd suggest? (I'm not getting the answers I need from logs by setting DEBUG=1) • Is the debugger functionality know to be a bit flakey? (if this is the case I'm happy to contribute PRs)
    f
    j
    • 3
    • 32
  • d

    Dennis Dang

    05/25/2021, 2:17 AM
    Is anyone importing ts enums from node_modules? I'm encountering a really weird issue. I can't tell if it's us or esbuild. i expect this import to get compiled away and never show up in the output js.
    Copy code
    import { LineItemStatus as TLineItemStatus } from "@canopyinc/api-docs/types/ts/EditLineItemInput.type";
    but it remains as an unused variable artifact in the lambda file as
    Copy code
    var import_EditLineItemInput = __toModule(require("@canopyinc/api-docs/types/ts/EditLineItemInput.type"));
    • 1
    • 2
  • a

    Ashishkumar Pandey

    05/25/2021, 8:07 AM
    I’m trying to use a custom domain with the Api construct, why would I get an error saying “CREATE_FAILED | AWS:CertificateManager:Certificate | ApiCertificatexxxxx No hosted zone found with ID: xxxx (Service: AmazonRoute53; Status Code: 404; Error Code: NoSuchHostedZone; Request ID: 37cb0031-2b4f-40a7-8e00-7d979975ecb4; Proxy: null)“. Also, point to note that the hosted zone id mentioned in the error and my actual hosted zone id are different values.
    f
    • 2
    • 12
  • a

    Anthony Xiques

    05/25/2021, 7:45 PM
    Hi all 👋 Question about the Share Code Between Services chapter. I'm following this:
    In our example, we want to share some common code. We’ll be placing these in a 
    libs/
     directory. Our services need to make calls to various AWS services using the AWS SDK. And we have the common SDK configuration code in the 
    libs/aws-sdk.js
     file.
    So in my monorepo, I have:
    Copy code
    - service1/
    - service2/
    - libs/
    - - - automation-helper
    And in
    service1
    :
    Copy code
    import { convertJsonStrToObj, generateResponse, validatePayload } from '../../libs/automation-helper';
    But I'm getting this serverless error when running
    serverless invoke local
    😭 Any ideas? Thanks!
    f
    • 2
    • 5
  • d

    Dennis Dang

    05/25/2021, 10:25 PM
    Hey Frank, as a temporary workaround, is it possible to use a different bundler besides esbuild for local dev? Or at least during the live reload rebuild. I'm still running into this weird bug, https://serverless-stack.slack.com/archives/C01JG3B20RY/p1621909026062100
    f
    • 2
    • 7
  • d

    Dennis Dang

    05/26/2021, 1:19 PM
    Copied to #seed Morning. Is there a Seed channel? We'd like to conditionally build some constructs differently for PR envs on Seed. How do we detect when CI is running in a PR env, as opposed to one of the explicit stages we've defined?
    r
    • 2
    • 2
  • j

    Jeffrey Budnick

    05/26/2021, 8:36 PM
    Hey all! Really enjoying the framework. Looking for some help with a pretty basic implementation. When I run "yarn run build", I'm getting an error at the Building Lambda function step that reads "Cannot find a handler file at src\functions\test.js". I've changed very little about the package that npx installed (typescript, use-yarn). Just added a functions folder inside the src, and changed the name of the default function to test.ts. I thought that I updated everything appropriately, but maybe not! Any ideas in here about where to start with this?
    f
    • 2
    • 4
1...456...83Latest