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

    Iamgingertrash

    09/09/2021, 2:48 AM
    Hey! Joining cause we still need help on this issue https://github.com/serverless-stack/serverless-stack/issues/803#issuecomment-915659084
    t
    a
    • 3
    • 34
  • a

    Abdul Taleb

    09/09/2021, 3:04 AM
    is
    this.addOutputs({...})
    sync or async? I'm wondering If I can run some code after it that can start an external service that can grab the env variables from sst
    t
    f
    b
    • 4
    • 48
  • a

    Abdul Taleb

    09/09/2021, 3:22 AM
    I've been trying to use the
    StaticSite
    construct and environment variables and it seems that it sets the variables with
    {{ VARIABLE }}
    rather than actually setting the variable, and after build it will inject the variable using some type of text match/find-replace. The problem is that in some static sites, the build happens via webpack and process.env.VARIABLE is handled via webpack's
    definePlugin
    module, which expects the actual value to be set before the build process. Has anyone faced this issue? If yes, how have you solved it? Any help would be appreciated.
    t
    • 2
    • 10
  • j

    Job de Noo

    09/09/2021, 8:28 AM
    Copy code
    {'version': '2.0', 'routeKey': 'GET /', 'rawPath': '/', 'rawQueryString': '', 'headers': {'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'nl-NL,nl;q=0.9,en-NL;q=0.8,en;q=0.7,en-US;q=0.6,fr;q=0.5', 'cache-control': 'max-age=0', 'content-length': '0', 'dnt': '1', 'host': '<http://l7m9q9ic8f.execute-api.us-east-1.amazonaws.com|l7m9q9ic8f.execute-api.us-east-1.amazonaws.com>', 'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"', 'sec-ch-ua-mobile': '?0', 'sec-fetch-dest': 'document', 'sec-fetch-mode': 'navigate', 'sec-fetch-site': 'none', 'sec-fetch-user': '?1', 'upgrade-insecure-requests': '1', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36', 'x-amzn-trace-id': 'Root=1-6139c317-73c82b1e16bbe783588a6ded', 'x-forwarded-for': '82.170.147.5', 'x-forwarded-port': '443', 'x-forwarded-proto': 'https'}, 'requestContext': {'accountId': '915964404932', 'apiId': 'l7m9q9ic8f', 'domainName': '<http://l7m9q9ic8f.execute-api.us-east-1.amazonaws.com|l7m9q9ic8f.execute-api.us-east-1.amazonaws.com>', 'domainPrefix': 'l7m9q9ic8f', 'http': {'method': 'GET', 'path': '/', 'protocol': 'HTTP/1.1', 'sourceIp': '82.170.147.5', 'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36'}, 'requestId': 'FYtrwjaDoAMEJkw=', 'routeKey': 'GET /', 'stage': '$default', 'time': '09/Sep/2021:08:17:27 +0000', 'timeEpoch': 1631175447808}, 'isBase64Encoded': False}
    SyntaxError: Unexpected token n in JSON at position 0
        at JSON.parse (<anonymous>)
        at createStrictSyntaxError (/home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/body-parser/lib/types/json.js:158:10)
        at parse (/home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/body-parser/lib/types/json.js:83:15)
        at /home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/body-parser/lib/read.js:121:18
        at invokeCallback (/home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/raw-body/index.js:224:16)
        at done (/home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/raw-body/index.js:213:7)
        at IncomingMessage.onEnd (/home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/raw-body/index.js:273:7)
        at IncomingMessage.emit (events.js:412:35)
        at IncomingMessage.emit (domain.js:470:12)
        at endReadableNT (internal/streams/readable.js:1317:12)
    Traceback (most recent call last):
      File "/home/jobdenoo/dearhealth/services/poc-sst/my-sst-app/node_modules/@serverless-stack/cli/scripts/util/bootstrap.py", line 99, in <module>
        r = request.urlopen(req, data=data)
      File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python3.8/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
        response = self.parent.error(
      File "/usr/lib/python3.8/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
        result = func(*args)
      File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 400: Bad Request
    c725cef9-e66c-4ffb-bc5c-5bad18ff538f ERROR Runtime exited with error: exit status 1
    a
    f
    • 3
    • 35
  • d

    Dan Van Brunt

    09/09/2021, 6:21 PM
    Having issues getting ESLint + Typscript + Prettier working with SST.
    Parsing error: “parserOptions.project” has been set for @typescript-eslint/parser.
    The file does not match your project config: .eslintrc.js.
    The file must be included in at least one of the projects provided.
    r
    f
    +2
    • 5
    • 42
  • a

    Ayo

    09/10/2021, 1:07 AM
    Hey I’m having issues with storing into my database using knex using async and await.
    t
    i
    • 3
    • 23
  • a

    Ayo

    09/10/2021, 3:59 AM
    Hey @thdxr I’m back lol. But we’re having another issue where everything works fine but when it’s time to return a response, it says lambda timed out
    a
    t
    • 3
    • 3
  • a

    Ayo

    09/10/2021, 1:59 PM
    Hey another issue I’m having is that I can’t access my environment when my functions are deployed to aws. This is the error I get from the logs
    t
    i
    • 3
    • 28
  • s

    Sam Hulick

    09/10/2021, 3:48 PM
    when I run
    yarn start
    , it prompts me with this:
    Copy code
    Look like you're running sst for the first time in this directory. Please enter a stage name you'd like to use locally. Or hit enter to use the one based on your AWS credentials (samh):
    this is due to removing stage from sst.json. I’d maybe modify that message, as it’s confusing. should it instead say that
    --stage
    is required?
    t
    • 2
    • 3
  • d

    Dan Van Brunt

    09/10/2021, 6:42 PM
    @Frank Think maybe there is a documentation error? It says, “Use the aws-ssm construct” is “Security: BEST”. • However, if you use this method to get an SSM secret’s value into a Lambda, you would have to pass them in as an environment var and would NOT need to
    Usage in Lambda: Fetch the SSM values inside a Lambda function using the AWS SDK
    as the docs further read. Perhaps there are two methods here: 1. Use
    aws-ssm
    construct to pass the ssm value at deploy time into something. (Security: it depends, secrets shouldn’t be stored in plain text as lambda env vars) 2. Pass the SSM parameter name into a Lambda as an env var. Then fetch that value inside the function using aws-sdk. No?
    t
    f
    • 3
    • 5
  • b

    Brett Fieber

    09/10/2021, 7:07 PM
    Is there a method to reset/recover 2fs for a Seed.run enterprise user? One of our users says:
    Hi
    is there a way to reset 2fa on seed.run? (edited) 
    I don't see the app in my authenticator app and can't login
    I'm not seeing anything in the UI and Manage user only lets me modify their Roles.
    f
    • 2
    • 1
  • d

    Dan Van Brunt

    09/10/2021, 7:30 PM
    I’m new to SST, I’m new to this lambda permissions property, that appears to just simply take in the instance of a resource. Is there any docs around this? I’m stumbling around CDK docs too to see if I missed some core functionality?
    t
    • 2
    • 8
  • d

    Dan Van Brunt

    09/10/2021, 8:36 PM
    Can I just say that I’ve used CDK before and loved it…. but man its A LOT more fun to use with SST. Simple things are just simple to do where this in not always the case with core CDK.
    t
    j
    f
    • 4
    • 22
  • d

    Dan Van Brunt

    09/10/2021, 8:52 PM
    Also interested in how the dev workflow works currently. At first, I thought things would run 100% local, but it appears that SST is deploying a stack before debugging/logging can work…. Next, I would have expected only a single stack, but we can see two?
    Copy code
    [stage]-[app]-[stack]
    [stage]-[app]-debug-stack
    t
    a
    j
    • 4
    • 29
  • d

    Dan Van Brunt

    09/10/2021, 9:19 PM
    I think I’m now having issues around permissions?
    t
    j
    f
    • 4
    • 12
  • a

    Aso Sun

    09/11/2021, 9:48 AM
    Hi, how can I set environment variables and permissions in Cron Stack? my code keeps showing
    Error: Invalid function definition for the "Job" Function
    Copy code
    import { Cron, Function } from "@serverless-stack/resources";
    
    this.function = new Function(this, 'scheduled', {
                handler: "src/scheduled.main",
                environment: {
                    TABLE_NAME: table.tableName,
                }
            })
    
    this.cron = new Cron(this, 'cron', {
                schedule: "cron(0 1 * * ? *)"
                job: {
                    function: this.function    
                },
            })
    this.cron.attachPermissions([table])
    f
    • 2
    • 3
  • m

    max.suster

    09/12/2021, 12:31 PM
    I have a question regarding how to tweak
    auth.addPermissionsToAuthRole
    . I assume this might have been asked before, but I can not find a clear and defintive answer in the context of SST. Essentially, I have already deployed an Auth sst stack with Cognito User Pools and its working fine for my ReactStaticApp. However, now I have a separate Infrastructure repository in which I created an Api sst stack, but I am struggling to use the same Cognito User pools already deployed for the React app. I have been trying to add IAM authentication (from the already existing User pool) to the Api SST stack by doing something very similar to a solution reported in a previous thread (adding a Policy to an IAM role). My solution gets deployed ok, but does not seem to work (I get HTTP 403 when using my existing Cognito User credentials). I assume this might not work without being able to refer to an instance of the original Auth stack? Does anyone have a suggestion for reusing an existing Auth/Cognito pools for an Api sst that is deployed in a separate repository? Thanks in advance.
    f
    • 2
    • 12
  • a

    Adrián Mouly

    09/13/2021, 1:45 AM
    Any experience with step-functions? recommendations, experiences?
    a
    s
    r
    • 4
    • 10
  • s

    Serhii Arendarchuk

    09/13/2021, 9:22 AM
    So, I have a two stacks, for eg. /auth and /profile and existed domain in ApiGateway, for eg domain.com (endpoint type - edge) Is there any posibility to connect existing stacks to that domain what are splitted by basePath, like domain.com/auth/* and domain.com/profile/* ? Thank you p.s. I tried many variants how to do it but without any results
    t
    b
    f
    • 4
    • 12
  • m

    mathewgries

    09/13/2021, 3:38 PM
    What I need to do: Update a column in on one entity based on another entities column value when adding or updating the second entity Entity one is an account record with a balance The new or updated entity is a transaction record against that account I want to update the balance on the account record based on the value of the new transaction, or an update on the value of the transaction I saw TransactWriteItems as a possible solution, but this appears to update records with the same key values? So my question is, should I be doing this via consecutive calls in the front end, ie add or update the transaction, and on “success” make a second call to update the account balance, or is there something available to update both records in a single call?
    r
    • 2
    • 10
  • a

    Adrián Mouly

    09/13/2021, 5:29 PM
    Does anybody know how to configure this EventBridge Target attributes on CDK?
    o
    • 2
    • 29
  • d

    Dan Van Brunt

    09/13/2021, 5:58 PM
    Is there a way with API to catchall on the “path” stay explicit with the “method”? Eg. (
    POST *
    )
    t
    • 2
    • 1
  • k

    Kelly Davis

    09/13/2021, 8:19 PM
    is there any way to force a static site deployment when running
    sst start
    and using the StaticSite construct? The issue is that I have a single step where I need to access the deployed static site (to setup some auth) and then the remainder of my access will be through localhost, but at the moment this means I first need to run
    sst deploy
    and after auth I run
    sst start
    . Also, it seems like
    sst start
    replaces the deployed static site with the placeholder site after a
    sst deploy
    , so if there was an option to suppressing the placeholder deploy, it would also solve my problem.
    t
    • 2
    • 3
  • o

    Ollie Camp

    09/14/2021, 1:52 PM
    I have two stacks and as far as I can tell the second stack should wait for the AssetsStack to deploy before it then deploys itself (I need the url for one of the routes in the api). But the value it ends up with is
    https://${Token[TOKEN.186]}
    which then results in the following error
    error Cannot find a handler file for "https://${Token[TOKEN.186]}"
    . I'm sure I've missed something obvious but I've now been starring at this problem to long to see it! lib/index.js
    Copy code
    import MyStack from "./MyStack";
    import AssetsStack from "./AssetsStack";
    
    export default function main(app) {
      // Set default runtime for all functions
      app.setDefaultFunctionProps({
        runtime: "nodejs14.x"
      });
    
      const assets = new AssetsStack(app, "assets-stack");
    
      new MyStack(app, "my-stack", { asset_url: assets.url });
    
    }
    lib/AssetsStack.js
    Copy code
    import  { Stack, StaticSite } from "@serverless-stack/resources";
    
    export default class AssetsStack extends Stack {
        url
        constructor(scope, id, props) {
            super(scope, id, props);
            
            // Create a Sattic Site
            const assets = new StaticSite(this, "Assets", {
                path: 'src/build/assets/'
            })
    
            this.url = assets.url
    
            // Show the endpoint in the output
            this.addOutputs({
                "CloudFrontEndpoint": assets.url 
            });
        }    
    }
    lib/MyStack.js
    Copy code
    import { Stack, Api } from "@serverless-stack/resources";
    
    export default class MyStack extends Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        const { asset_url } = props
    
        // Create a HTTP API
        const api = new Api(this, "Api", {
          routes: {
            "GET /_app": asset_url,
            "$default": "src/lambda.handler",
          },
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          "ApiEndpoint": api.url
        });
      }
    }
    t
    • 2
    • 22
  • a

    Ayo

    09/14/2021, 3:53 PM
    Hey I am trying use a custom domain for my serverless stack project. I try to follow the guide SEED provided to do it, but when I click on edit custom domain it shows me no endpoints are available even though I used seed to deploy my project and it shows the aws default endpoint URL. Am I missing something?
    t
    f
    • 3
    • 49
  • t

    thdxr

    09/14/2021, 6:14 PM
    Has anyone gotten provisionedConcurrentExecutions working? Think it's more complex that I thought
    f
    j
    • 3
    • 4
  • s

    Stan

    09/14/2021, 6:26 PM
    Anyone tried dynamodb local to run tests with jest? I'm trying to use this one: https://github.com/shelfio/jest-dynamodb but SST seems to not allow configuring Jest presets
    f
    g
    t
    • 4
    • 20
  • a

    Abdul Taleb

    09/14/2021, 6:57 PM
    What kind of permissions do I need to give/set to allow a cognito identity pool unauthenticated access to a protected api endpoint? How would I do that using the Auth construct. Would it be something like below. I know there is a way to do this to allow for rate limiting and support user sessions.
    Copy code
    const apiAuth = new sst.Auth(this, 'auth', {
          cognito: {
            userPool: myUserPool,
            userPoolClient: myUserPoolClient,
          },
          identityPool: {
            allowUnauthenticatedIdentities: false,
            identityPoolName: `api-identity-pool-${scope.stage}`,
          }
        });
    
       const api = new sst.Api(this, 'api', { ...with JWT or Cognito Authorizer.. });
    
       apiAuth.attachUnauthPermissions([api]);
    f
    • 2
    • 15
  • d

    Dan Van Brunt

    09/14/2021, 9:00 PM
    Maybe I’m the only one, but I did get hung up very briefly on a weird “Getting Started” thing with the docs, templates and and deployment. I first got SST setup using…
    yarn create serverless-stack my-sst-app --language typescript
    I then created a folder in the root called
    /frontend
    then I copied all my react-app src into there then I used the example
    StaticSite
    code…
    Copy code
    new StaticSite(this, 'GatsbySite', {
          path: 'frontend',
          errorPage: '404.html',
          buildOutput: 'public',
          buildCommand: 'yarn build',
        })
    then I ran
    yarn sst deploy
    then it ran in a loop over and over, endlessly. Answer: Took a sec but I realized that the above example code to
    yarn build
    but the root sst package.json is already set to
    _"build"_: "sst build",
    hence the loop. What IS the buildCommand supposed to be set to by example?
    Copy code
    buildCommand: 'yarn build:frontend',
    or
    Copy code
    buildCommand: './frontend/yarn build',
    t
    f
    • 3
    • 25
  • a

    Adrián Mouly

    09/14/2021, 10:08 PM
    Can somebody tell me which tool is being used to build these diagrams? looks like some AWS folks follows this convention.
    k
    • 2
    • 4
1...171819...83Latest