https://serverless-stack.com/ logo
Join Slack
Powered by
# sst
  • a

    arda

    11/03/2021, 6:51 PM
    Hi all, I am wondering if this is a NextJS issue or a SST issue. Somehow I am not able to pass my env variables to Amplify configure. but it works if I set the configure directly. The
    process.env
    is printed alright in my terminal. Do my miss something? Do I have to prefix
    NEXT_PUBLIC_
    to these variables?
    d
    y
    • 3
    • 12
  • c

    Clayton

    11/03/2021, 7:38 PM
    Is there a way to declare the local version of node SST should use when running live dev? After updating node to v17 I now see the error below in the console. I’ve installed node v16 as well and tried adding a
    .nvmrc
    file at the project root (e.g. with ‘16’) but it doesn’t seem to affect things.
    t
    d
    +3
    • 6
    • 19
  • r

    Ross Coundon

    11/03/2021, 8:14 PM
    I'm working with the guys at Thundra to evaluate their APM product as a replacement for Epsagon. When wrapping a lambda using their library SST deploy errors out with the following:
    Copy code
    > node_modules/jest-pnp-resolver/index.js:46:4: error: Cannot assign to "defaultResolver" because it is a constant
        46 │     defaultResolver = getDefaultResolver();
           ╵     ~~~~~~~~~~~~~~~
       node_modules/jest-pnp-resolver/index.js:13:18: note: "defaultResolver" was declared a constant here
        13 │   const {basedir, defaultResolver, extensions} = options;
           ╵                   ~~~~~~~~~~~~~~~
    
     > node_modules/fsevents/fsevents.js:13:23: error: No loader is configured for ".node" files: node_modules/fsevents/fsevents.node
        13 │ const Native = require("./fsevents.node");
           ╵                        ~~~~~~~~~~~~~~~~~
    
     > node_modules/jest-pnp-resolver/getDefaultResolver.js:8:32: error: Could not resolve "jest-resolve/build/default_resolver" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
        8 │       defaultResolver = require(`jest-resolve/build/default_resolver`...
          ╵                                 ^
    
     > node_modules/jest-config/build/vendor/jsonlint.js:909:22: error: Could not resolve "file" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
        909 │     var cwd = require('file').path(require('file').cwd());
            ╵                       ~~~~~~
    Is there anything that I can go back to the team with in terms of things they could change to make it work?
    t
    m
    s
    • 4
    • 33
  • a

    Adrián Mouly

    11/04/2021, 3:37 AM
    Hey guys… I want to re-use a function, to be called by a Cron and also by API GW… Do I need to define the
    permissions
    on each integration? or I can jut define a Function and assign the permissions to it, and later attach that function to both Cron and GW?
    f
    t
    • 3
    • 23
  • a

    Adrián Mouly

    11/04/2021, 4:50 AM
    Question about shared-libraries for micro-services: If you create a shared-library that is used by many different functions…. and in that logic, for example, you need to trigger an Event on EBridge… That means every Lambda consumer of that library, will need to have access to the EBridge, with permissions. And possibly also an environment variable with the EBridge location, due the library doesn’t know which is the AWS Resource. And other stuff could be needed too. And that’s not clear for the consumer… you are “consuming” a library which might be a “black box” ideally. For example… “Users Library” which contains “Update User” which triggers “User Updated” event. Also this creates coupling between those “consumers” of the library and every resource that is needed… Which could be OK, but that can be messy if you have many things shared. This is why I prefer to encapsulate that logic in a different Lambda instead of Library… doing something like “Lambda calling Lambda” (or maybe a REST API) that other functions can consume, that way we encapsulate the logic and permissions of the “shared code”. Thoughts? @thdxr @Frank
    m
    o
    +3
    • 6
    • 19
  • g

    Greg Martin

    11/04/2021, 2:47 PM
    In the Notes example, the whole kitchen sink is rolled into a single project. Is there any wisdom to breaking it into 2 separate projects. One for the API and Data and another for the front end React app? I can see where I might ultimately have multiple front end apps all talking to the same API. Also, I have development teams that are very focused on backend and database and others that are all about the front end. Separation of concerns seems wise to me. Thoughts?
    t
    d
    • 3
    • 8
  • d

    Dan Van Brunt

    11/04/2021, 5:18 PM
    Question for the core team: Have you guys considered / Do you have a living + public roadmap for SST?
    k
    • 2
    • 1
  • d

    Dan Van Brunt

    11/04/2021, 8:18 PM
    Not sure if I’m doing something wrong but suddenly our
    .env.local
    env vars are not being loaded into the process.env in the
    sst.Stack
    we just moved from
    0.48.0
    to
    0.50.2
    t
    g
    ö
    • 4
    • 20
  • n

    Noah D

    11/04/2021, 9:03 PM
    Hey guys, curious to hear what people's thoughts were around running an express server connected to the api-gw such that each route would have only one lambda function which handles routing etc? Heard the idea thrown around a bit recently, the main pro I can see for this is that it would reduce cold start times since the function would be getting used more, but that may be negligible if you had enough throughput on your lambdas? I imagine though there are other reasons like being able to use a bunch of express middleware and have access to that ecosystem?
    a
    d
    m
    • 4
    • 13
  • s

    Sione

    11/05/2021, 1:27 AM
    I didn't realized until recently after reading some of the comments here, that you can actually call localhost from within your SST Lambdas on development! I think that's real game changer for dev exp. We have a python api server running on fargate in prod and it's easier on dev to run it locally with docker together with local postgres, but with SST I can call and connect to them from lambdas. Another usecase that I just build was having to test incoming webhooks, but with api not being serverless, instead of using something like ngrok to tunnel remote calls or deploying to check. I used a SST lambda that basically proxy remote call to my local api server and it just works. Just wanted to pointed that out here, incase someone find it useful. Love the community here and amazing work from the SST team.
    t
    j
    • 3
    • 4
  • d

    Dan Van Brunt

    11/05/2021, 2:55 AM
    It appears that using Datadog’s CDK construct to wrap lambdas seems to break SST’s live lambda dev, swallowing the output… so I’m not getting nothing in the console. Perhaps adding monitoring like this should only happen when not
    IS_LOCAL
    ?
    t
    • 2
    • 6
  • o

    Omi Chowdhury

    11/05/2021, 4:25 AM
    I’m getting an error with sst start (but not sst deploy):
    Copy code
    invokeError [1636085771837] started /Users/omi/workspaces/libs/lambda-utils/index.ts:1
    import LogUtils, { CoveLogger, ChildLogger } from '@fragment/log-utils';
    ^^^^^^
    
    SyntaxError: Cannot use import statement outside a module
    I’ve tried to dig into this a bit, this is the generated import in `.build`:
    Copy code
    var import_lambda_utils = __toModule(require("@fragment/lambda-utils"));
    So for some reason esbuild is thinking that module doesn’t need to be bundled and transpiled
    • 1
    • 2
  • r

    Ross Coundon

    11/05/2021, 7:33 AM
    I'm working with the guys at Thundra to get the travel time debugging (TTD) option working (tracing now works with just the inclusion of a layer! @Adrián Mouly) The way TTD works is you give it an env var that represents the path of the handler so that it can slurp up the code. We're struggling, we think, because of the output structure from esbuild. They are considering an esbuild plugin to set this up (they already have one for webpack) Therefore, for debugging purposes I'm trying to build unbundled but I'm getting the error
    Copy code
    Error: Bundle cannot be disabled for the "AuthorizerFunction" function since the "srcPath" is set to the project root. Read more here — <https://github.com/serverless-stack/serverless-stack/issues/78>
    Looking at the github issue I'm confused as to how to workaround this. Shifting my
    src
    down a level doesn't make any difference. Does the code need to live in an entirely different folder structure for this to work?
    f
    s
    • 3
    • 12
  • c

    Clayton

    11/05/2021, 2:33 PM
    This is likely a dumb question but here’s to becoming less dumb - I’ve noticed I can import various
    aws-cdk
    packages in a stack (e.g.
    @aws-cdk/aws-events
    ) and have been able to successfully run and build the stack without having to install these packages first in the project. Is this ok, or should they be listed in the project’s package.json? And if so, is it ok for them to be devDependencies only?
    t
    d
    b
    • 4
    • 17
  • s

    Seth Geoghegan

    11/05/2021, 3:01 PM
    I was setting up a new stack that references an SSM variable that I created manually in the AWS console. Therefore, the stack creation failed when executing
    sst start
    .
    Copy code
    sgeoghegan-kas-api-stack | CREATE_FAILED | AWS::CloudFormation::Stack | sgeoghegan-kas-api-stack 
    
     ❌  sgeoghegan-kas-api-stack failed: ERROR Parameter Name /sgeoghegan/kas/api-url with a different configuration already exists.
    
    
    Stack sgeoghegan-kas-db-stack
      Status: deployed
    
    Stack sgeoghegan-kas-api-stack
      Status: failed
      Error: ERROR Parameter Name /sgeoghegan/kas/api-url with a different configuration already exists.
    
    Failed to deploy the app
    error Command failed with exit code 1.
    info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
    d
    f
    • 3
    • 25
  • b

    Blake E

    11/05/2021, 4:04 PM
    So I’m playing with
    NextjsSite
    construct, with an oauth flow which requires an https redirect - so rather than struggle to setup a local cert, I’ve been deploying to test my code - which doesn’t provide the sexiest workflow. Normally, with sst,
    sst start
    would get me what I want - but with nextjs a boilerplate temp site is deployed, and nextjs is run locally at
    localhost:3000
    which doesn’t satisfy my oauth partner requirements. I’m considering ngrok to my localhost, so I can edit code locally while I test this oauth flow, but anyone have any other suggestions? Workarounds for the lack of local tunneling for
    next dev
    sites?
    t
    f
    • 3
    • 7
  • j

    Joe Kendal

    11/05/2021, 4:37 PM
    Hi, what’s the SST approach to Provisioned Concurrency?
    t
    j
    +3
    • 6
    • 73
  • c

    Clayton

    11/05/2021, 6:09 PM
    It looks like SST’s
    .addOutputs
    method publishes outputs without an
    export name
    value set – making the value inaccessible to
    cdk.Fn.importValue
    . Is there are way to add an export name to a SST created output or should you duplicate these via
    cdk.CfnOutput
    ? I’m finding myself creating outputs via
    .addOuputs
    for consumption by other SST stacks within the same service and by
    cdk.CfnOutput
    for consumption by other Services’ stacks in the same account – which leads to duplicate outputs. Not a huge issue, but would be nice remove the duplication in the code and console if possible.
    t
    f
    • 3
    • 7
  • r

    Ross Coundon

    11/05/2021, 8:45 PM
    I've got an odd problem that the debugger is no longer hitting my breakpoints. I think I remember a Visual Studio Code update yesterday (1.62.0) but other than that, I can't think of what's changed. Anyone know of a way to debug the debugger?
    j
    • 2
    • 5
  • r

    Ross Coundon

    11/05/2021, 10:56 PM
    I have a single function definition that can be included in a stack multiple times with different names.
    Copy code
    datasetIds.forEach((datasetId) => {
          
          const populatorFunction = new sst.Function(this, `populatorFunction-${datasetId}`, {
            handler: 'src/main/handler/populator.startLookingForMissingUrls',
            environment: {
              OFSC_INSTANCE: datasetId,
            },
          });
    
          new sst.Cron(this, `OmwPopulatorCron=${datasetId}`, {
            schedule: process.env.POPULATOR_CRON,
            job: {
              function: populatorFunction,
            },
          });
    })
    So you can see that the OFSC_INSTANCE env var is set according to the value from a string array defined earlier. When running this using
    sst start
    I'm seeing some odd behaviour regarding the env var OFSC_INSTANCE. On the first kick off of each lambda via the cron, sometimes the value of the env var is correct. However, after that, both lambdas have the same value for that env var. Sometimes they're the same on first start too. Is there something about the local execution environment that would env vars end up getting shared between invocations of shared code?
    t
    • 2
    • 1
  • m

    Muhammad Ali

    11/07/2021, 2:14 AM
    Another dumb question from me 😄 What implementation do i need to allow a user to signup using cognito. Like for now, I am using shell to sign up a user i.e.,
    aws cognito-idp sign-up
    ... but i have to provide a rest endpoint for user so that they can do signup themselves (and do challenge to confirm signup). I mean there must be a library from
    aws-cdk
    which provides user signup from backend code?
    o
    c
    +2
    • 5
    • 10
  • k

    Kevin Baker

    11/07/2021, 1:19 PM
    Is there a way to break up stacks so that changes to one stack do not force a redeploy of the other? For instance DatabaseStack and ApiStack. Then I could redeploy only changes to ApiStack, hopefully speeding development. This seems to be related, but I haven’t sorted it out yet: https://docs.serverless-stack.com/constructs/Api#sharing-an-api-across-stacks
    t
    d
    f
    • 4
    • 9
  • d

    Dillon Peterson

    11/07/2021, 1:37 PM
    Currently getting a 503 on all of my NextJsSite API endpoints. Has anyone else had this issue?
    r
    f
    +2
    • 5
    • 57
  • h

    Haseeb Naseem

    11/08/2021, 9:54 AM
    Is it possible for an sst stack to connect to a local database instead of one running and created in aws ? Our concern is that if we have multiple engineers working locally, sst will create multiple databases which doesn’t seem right. https://serverless-stack.com/examples/how-to-use-postgresql-in-your-serverless-app.html
    j
    j
    +3
    • 6
    • 21
  • s

    Syed Farhan

    11/08/2021, 7:46 PM
    I keep getting these logs on the new sst version (v0.50.2) in live lambda development. Along with general slowness after not hitting the lambda endpoint for a few minutes. Any ideas on what this is about?
    Copy code
    Warning: Ignoring extra certs from `/etc/pki/tls/certs/ca-bundle.crt`, load failed: error:02001002:system library:fopen:No such file or directory
    and
    Unexpected Top Level Error: Error: socket hang up
    t
    d
    • 3
    • 5
  • m

    Muhammad Ali

    11/09/2021, 5:11 AM
    Question regarding using relational database. I see in this example, It is said that I have to go to aws ui and create tables manually. Is there a way to add db migrations as part of sst?
    t
    p
    • 3
    • 4
  • s

    Sean Matheson

    11/09/2021, 9:42 AM
    Question: Does the Api construct allow wildcarding for the routes? i.e.
    /foo/*
    would match
    /foo/bar
    and
    /foo/bar/baz
    t
    • 2
    • 1
  • j

    Josep Segarra

    11/09/2021, 10:38 AM
    Hi. We're trying to automate a docker compose down that stops local configs and the current running lambda at the same time. Right now we are basically running a "kill -9 <sst start process id>", but we are wondering if there is a much safer way to do that
    r
    t
    • 3
    • 9
  • y

    Yuval Ron

    11/09/2021, 10:49 AM
    Anyone uses Webstorm debug with SST (Node and Typescript) successfully? The best I have is to create npm debug configurations, which do stop on breakpoints but only on transpiled files, not on the original source.
    r
    b
    n
    • 4
    • 4
  • s

    Sean Matheson

    11/09/2021, 3:42 PM
    Question: Is it possible to rename/configure the directory name for the lambdas? I'd like to change it from
    src
    to
    lambdas
    t
    • 2
    • 8
1...181920...33Latest