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

    Adrian Schweizer

    12/27/2021, 9:25 PM
    Something I've noticed, which is potentially a bit dangerous, is that the redeploy functionality seems to read the stage to deploy to anew from file when hitting enter. At least that's what I guess that happened, when I had first started the local dev, then in another terminal window, deployed to prod, then made some further changes, and in the window the local dev was still running, eventually hit enter to redeploy (the local dev). But it then deployed the new changes to prod. It also reported a failure to deploy, despite there not being one (probably because it was confused by the stage switch).
    t
    • 2
    • 2
  • d

    Devin

    12/28/2021, 12:09 AM
    I’m doing something in a kind of naive way. I think perhaps what I “should” do is different. Would love to hear how you might handle this. I send an SMS form my app. I store the message:
    Copy code
    pk: SID#${messageid} | sk: SID#${messageid} | messageStatus | gsipk
    Then twilio hits a callback with the SID# where I update the status. The front end polls against the gsipk Once the
    msssageStatus
    is delivered or
    failed
    you can resend. This works pretty great 🎉. But I’m now storing each message in the database. Which is not needed. So, after creating a message, I’m just deleting the old message.
    Copy code
    await dynamoDb.put(params);
    
        if (shouldDeleteOldMessage) {
          const existingItem = {
            TableName: process.env.TABLE_NAME,
            Key: {
              pk: existingPk,
              sk: existingPk,
            },
          };
          await dynamoDb.delete(existingItem);
        }
    Seems bad to make the front end wait until after I delete the item (or worse fail because that operation fails. I have some alternative thoughts but I’m curious what you’d do?
    t
    o
    r
    • 4
    • 6
  • s

    Sam Hulick

    12/28/2021, 7:16 AM
    I’m having a new issue since the most recent SST release. I think it has to do with code being executed from
    .sst/artifacts
    now, maybe.
    here’s the error:
    Copy code
    Something went wrong installing the "sharp" module
    
    Cannot find module '../build/Release/sharp-darwin-x64.node'
    Require stack:
    - /Volumes/SuperData/Sites/reelcrafter/v2-microservices/.sst/artifacts/9ed24b68/src/lambda/rest/functions/update-media.js
    - /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/aws-lambda-ric/lib/utils/UserFunction.js
    - /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js
    - /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/aws-lambda-ric/bin/index.js
    but the
    .node
    file it’s looking for totally exists in
    node_modules/sharp
    . this was working ok before
    f
    t
    b
    • 4
    • 27
  • m

    Mischa Spiegelmock

    12/28/2021, 3:09 PM
    I’ve got this problem where my functions get packaged according to my filesystem. I guess it’s because I am passing in an absolute path for the
    srcPath
    ? Anything I can do about this?
    Error: Cannot find module 'search'
    j
    • 2
    • 2
  • s

    Sam Hulick

    12/28/2021, 8:01 PM
    does anyone know how to attach multiple custom domains to a single HTTP API?
    f
    • 2
    • 25
  • j

    justindra

    12/28/2021, 11:58 PM
    I had an old project that was still on SST v0.4.0 and now just upgrading to the latest version. Running into an issue now when I run
    sst build
    the type-checking is type checking
    @types/react
    in my
    node_modules
    The setup is using Yarn Workspaces monorepo
    Copy code
    (root)
    + infra
      + cdk (this is where SST is)
    + apps
      + admin (a react app)
      + web (another react app)
    Any thoughts?
    f
    t
    • 3
    • 8
  • c

    chittasec

    12/29/2021, 2:16 AM
    Hello All, seems the cognito hosted UI logout URL is getting generated wrong. I have the custom domain setup "auth.myebsite.com" . So the logout URI should be "https://auth.mywebsite.com/logout?client_id=<client_id>&logout_uri=https://website.com/" . However when I do Auth.signout() , the URL is re-directed to "https://auth.mywebsite.com.auth.ap-southeast-1.amazoncognito.com/logout?client_id=<client_id>&logout_uri=https://website.com/". I am missing something or it is a bug ? Login URI works perfect .
    j
    f
    • 3
    • 3
  • m

    mathewgries

    12/29/2021, 2:11 PM
    Hello. Before SST, we used to have a yaml file to set up the resources. I am trying to find where these permissions are being stored for SST so I can update them to include batcWriteItem permissions for my table. I checked the cloud formation templates that are created for the table, api, auth, debug stack, and frontend, but am not seeing anything similar to this. Thanks
    t
    j
    • 3
    • 6
  • m

    Mischa Spiegelmock

    12/29/2021, 2:18 PM
    With this patch I’m able to build/deploy my project on 0.53.0 But on 0.55.0 I cannot:
    Copy code
    ReferenceError: require is not defined in ES module scope, you can use import instead
    This file is being treated as an ES module because it has a '.js' file extension and '/Users/cyber/dev/platform/packages/infra/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
        at file:///Users/cyber/dev/platform/packages/infra/.sst/artifacts/1d3e06ae/builder.js:2:25
        at ModuleJob.run (internal/modules/esm/module_job.js:170:25)
        at async Loader.import (internal/modules/esm/loader.js:178:24)
        at async Object.loadESM (internal/process/esm_loader.js:68:5)
        at Object.bundle (/Users/cyber/dev/serverless-stack/packages/core/dist/runtime/handler/node.js:198:23)
        at Object.bundle (/Users/cyber/dev/serverless-stack/packages/core/dist/runtime/handler/handler.js:19:16)
        at new Function (/Users/cyber/dev/serverless-stack/packages/resources/src/Function.ts:359:39)
        at Function.fromDefinition (/Users/cyber/dev/serverless-stack/packages/resources/src/Function.ts:528:14)
        at PlatformApi.addResolver (/Users/cyber/dev/serverless-stack/packages/resources/src/AppSyncApi.ts:376:19)
        at /Users/cyber/dev/serverless-stack/packages/resources/src/AppSyncApi.ts:203:23
        at Array.forEach (<anonymous>)
        at PlatformApi.addResolvers (/Users/cyber/dev/serverless-stack/packages/resources/src/AppSyncApi.ts:201:28)
        at new VacancyService (/Users/cyber/dev/platform/packages/infra/lib/service/vacancy.ts:23:13)
        at new ApiServices (/Users/cyber/dev/platform/packages/infra/lib/service/apiServices.ts:68:5)
    t
    • 2
    • 37
  • r

    Ryan Martin

    12/29/2021, 2:44 PM
    Question: I created the Scratch note taking app a while back and it was a great experience. I would now like to use that setup to create a new app. Is there an article or anything out there about Best Practices for taking the Scratch App, cloning it, and creating a new application? If so, awesome. If not, I think that could be a really great tool for people out there to be directed to after completing the Scratch App.
    d
    • 2
    • 9
  • i

    ipsherman

    12/29/2021, 3:01 PM
    Question: Going through the Guide, at the "Configure AWS Amplify" on the frontend step, and the install command is
    npm install aws-amplify
    , noticeably not
    npm install aws-amplify --save
    . Is there a reason why this step doesn't
    --save
    ? Thanks!
    r
    • 2
    • 3
  • r

    Ryan Martin

    12/29/2021, 4:29 PM
    Question on the aws side: when you want to make a new serverless app, do you guys just make a whole new aws account every time, or is there a better way to do it? Just trying to figure out what the “best practice” is for that part.
    m
    s
    • 3
    • 2
  • f

    Federico Miras

    12/29/2021, 6:42 PM
    Hi everyone! how are you? I've created my first SST application and I want to create some e2e test on it, is there any guide to do that using the testing framework SST comes with? In the examples there is only asserts of infrastructure right? I want to specifically hit the lambdas with requests and asserts response code/headers/body
    f
    • 2
    • 6
  • r

    Ross Gerbasi

    12/30/2021, 12:01 AM
    Hey all, pretty new to SST but pushing to go all in on it for my org. I am trying to figure out, how can I create multiple authorizers for an API? I am following this (https://docs.serverless-stack.com/constructs/Api#adding-lambda-authorization-to-a-specific-route) but instead of using only
    authorizationType
    I am setting
    authorizer
    for two different endpoints. When I do a build I notice the authorizers are not in the JSON template at all. I only seem to be able to get one authorizer to show up and that's when I use
    defaultAuthorizer
    on the whole gateway. Am I missing something dumb?
    f
    • 2
    • 4
  • m

    Maged Mortaga

    12/30/2021, 3:31 AM
    Quick deployment question: How do you guys handle downtime during deployment? Is there a nice way to either let the user know that the site is currently not available while it is being deployed by SST/CDK or maybe redirect all incoming traffic to an existing cloudformation distrubution? Especially since the deployment of the ReactStaticSite takes a while.
    f
    • 2
    • 5
  • j

    John Kor

    12/30/2021, 6:38 AM
    hi everyone! im trying to debug a Runtime.ImportModuleError error and ive hit a wall 😞 with the local development workflow, everything works fine 👍 once i build and deploy to prod, i can see in the cloudwatch logs that the lambda function does not start properly due to an
    Runtime.ImportModuleError
    error. i have a simple sqs queue with a lambda fn attached as a consumer. ive added
    mysql2
    and
    knex
    as layers. the specific error is that the module
    knex
    cannot be found during runtime. any advice on how to debug this issue? thanks in advance!
    slack search is your friend 😉 https://serverless-stack.slack.com/archives/C01JG3B20RY/p1623958746417900
    s
    • 2
    • 2
  • m

    Mischa Spiegelmock

    12/31/2021, 9:27 AM
    I’ve got this problem where my functions get packaged according to my filesystem. I guess it’s because I am passing in an absolute path for the 
    srcPath
     ? Anything I can do about this?
    Error: Cannot find module 'search'
    f
    t
    • 3
    • 13
  • g

    gio

    12/31/2021, 9:29 AM
    I would like receive some suggestion about the project I’m working on, which is increasing the number of AWS resource very fast. In this moment it counts 417 resource on 500 available for the same stack. I decided to choose a mono-stack architecture to make easier dependencies resolution among resources, but it is not feasible anymore as solution, so I need to move to multi-stack architecture. My project is composed by: 1) 1 Admin angular app (sst.StaticSite) with its specific APIs (this APIs are most part of all defined resources and probably it will increase the number of services, they are almost 280 but it’s very unusual to growth more than 400) 2) 1 User angular app (sst.StaticSite) with their specific APIs (the count of defined resources for this APIs is low but in future for business purpose could be extended much more) 3) 2 Userpools (one for users and one for admins) 4) 1 Single DynamoDB table 5) 2 S3 bucket to let persistence for user and admin At the begining I was oriented to choose this solution: 1) Stack for Admin app: (app + api) 2) Stack for User app: (app + api) 3) Stack Core(Userpool, bucket, table) My doubts are: 1) Is it suggested in a multistack architecture includes in same stack app and api? Or it’s better to define an app as a per stack or join all apps in same stack? 2) Is it suggested to define a core stack as I described? Or it’s better to divide userpools from bucket and table? These type of resource are pretty immutable so I think could be good to keep them together.
    a
    f
    • 3
    • 3
  • j

    Joshua Oransky

    12/31/2021, 2:28 PM
    When I set up a custom domain for my API, I didn't initially set a path, and now I want to. However, I'm reading in the docs that "Note, if the 
    path
     was not defined initially, it cannot be defined later... Instead, you'd need to remove the 
    customDomain
     option from the construct, deploy it." I've tried this and it doesn't seem to add it. Is there something specific that needs to happen to be able to add a path to a custom domain when it wasn't defined previously?
    f
    t
    • 3
    • 11
  • s

    Sam Hulick

    12/31/2021, 7:02 PM
    is there some way with the
    Api
    construct to specify a wildcard for a route? e.g.
    GET /something/*
    ? I need the route to match
    /something/123abc
    as well as
    /something/hi/hello
    . does
    GET /something/{proxy+}
    work?
    a
    f
    • 3
    • 6
  • s

    Sam Hulick

    01/01/2022, 12:31 AM
    just leaving this here (NOT urgent) SST Console is showing “Error fetching metadata”. I don’t think anything has changed on my end. here’s a HAR file showing the errors (OPTIONS & POST failed for localhost:12557)
    t
    f
    p
    • 4
    • 16
  • j

    Jacob Hogenkamp

    01/01/2022, 6:25 PM
    Is there a recommended way to re-run events? In serverless framework, I would usually run something like:
    Copy code
    sls invoke local -f <handler> -d '<event>'
    Is it better to use a local invokation with SAM or is there a way to leverage the live-lambda environment? My use case is to iteratively rerun a S3 upload notification event when an image processing handler fails and needs debugging.
    g
    f
    j
    • 4
    • 4
  • g

    Garret Harp

    01/02/2022, 8:58 PM
    Anyone happen to know if it's possible to create a ULID (or any time sorted id) in appsync without having to use a lambda resolver? From docs it seems they only have UUID generate util.
    j
    t
    • 3
    • 4
  • c

    Carlos Daniel

    01/03/2022, 2:46 AM
    Guys, I think I have a bug to report - or at least is something I did not know might have happened. The first screenshot I sent was the
    index.js
    of my application. I have an app called copy-ddb-table, and I was creating a stack called stack on it, so the full name of my stack (when running locally) was supposed to be something like
    local-copy-ddb-table-stack
    , right? But what had happened was, when I passed the property stackName to my stack (line 11), it actually has changed the whole stack name. So instead of having a stack called
    local-copy-ddb-table-stack
    , I was having a stack called
    local-copy-ddb-table
    because is the string generated from my template string. And the bug is, since the stack name generated by the app was different than the stack name on the props, I received an error when running the
    sst start
    (screenshot 2).
    f
    • 2
    • 15
  • g

    Garret Harp

    01/03/2022, 4:44 AM
    Anyone might know why query limit might not be working for me? This is my request map template:
    Copy code
    {
    	"version": "2018-05-29",
    	"operation": "Query",
    	"query": {
    		"expression": "#PK = :userId and begins_with(#SK, :noteItem)",
    		"expressionNames": {
    			"#PK": "PK",
    			"#SK": "SK"
    		},
    		"expressionValues": {
    			":userId": $util.dynamodb.toDynamoDBJson("USER#$ctx.args.userId"),
    			":noteItem": $util.dynamodb.toDynamoDBJson("NOTE#")
    		},
    		"limit": $util.toJson($util.defaultIfNull($ctx.args.limit, 20))
    		#if($ctx.args.nextToken)
    		, "nextToken": $util.toJson($ctx.args.nextToken)
    		#end
    	}
    }
    f
    • 2
    • 2
  • d

    Derek Kershner

    01/03/2022, 4:46 PM
    Experiencing a weird issue regarding permissions, I have 4 different stacks giving permissions to a lambda function the ability to read dynamo streams and to send messages to a SQS DLQ. The function find:
    Copy code
    lambda.Function.fromFunctionAttributes(
                this,
                "EventsPublisherFunction",
                {
                    functionArn: ssm.StringParameter.valueForStringParameter(
                        this,
                        RESONANCE_EVENTS_PUBLISHER_FUNCTION_ARN_SSM_PARAM
                    ),
                    role: iam.Role.fromRoleArn(
                        this,
                        "EventsPublisherFunctionRole",
                        ssm.StringParameter.valueForStringParameter(
                            this,
                            RESONANCE_EVENTS_PUBLISHER_FUNCTION_ROLE_ARN_SSM_PARAM
                        )
                    ),
                }
            );
    A sample grant:
    Copy code
    distributionDynamoDlq.grantSendMessages(this.eventsPublisherFunction);
            this.distributionDynamoTable.grantStreamRead(
                this.eventsPublisherFunction
            );
    The issue is that only the LAST stack deployed sticks, as in it overwrites the other stacks permissions, and only grants
    eventsPublisherFunction
    its resources. Is this expected behavior?
    t
    f
    • 3
    • 26
  • s

    Seth Geoghegan

    01/03/2022, 5:59 PM
    Any tips to debug a long running stack creation/deletion? I am using the sst.Script construct to manage DB migrations. I've written a simple lambda that creates a database
    onCreate
    and removes a database
    onDelete
    . I've tested by putting the lambda behind the sst.API construct and it works fine. However, when I define the sst.Script construct with the same lambda,
    sst start
    and
    sst remove
    take very long (20+ minutes). Without the Script construct, these actions take around 1-2 minutes to deploy from scratch. Any tips to debug this, or is this the expected behavior with custom resources?
    t
    f
    m
    • 4
    • 27
  • m

    Mischa Spiegelmock

    01/03/2022, 7:22 PM
    I thought to run
    sst build
    in my CI build/test action, but I get this error:
    Copy code
    [Error at /none-platform-tombo] Need to perform AWS calls for account my-account, but no credentials have been configured
    Found errors
    There was an error synthesizing your app.
    npm ERR! Lifecycle script `build` failed with error: 
    npm ERR! Error: command failed 
    npm ERR!   in workspace: platform-infra@0.1.0 
    npm ERR!   at location: /home/runner/work/platform/platform/packages/infra
    t
    f
    • 3
    • 15
  • m

    Mischa Spiegelmock

    01/03/2022, 7:23 PM
    why does build need to perform AWS calls? how should I test that I can synthesize my stack okay in CI?
    d
    • 2
    • 2
  • s

    Sam Hulick

    01/03/2022, 8:41 PM
    I just realized the past dozen or so of our releases haven’t published source maps to Sentry 😕 something must’ve changed with SST in how it builds source files, or maybe executes esbuild plugins?
    t
    • 2
    • 66
1...383940...83Latest