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

    Nicklas Christiansen

    04/17/2022, 11:53 AM
    Noob Expo + amplify + cognito question and beginner sst developer here, so please bare with me 🙂 I have created frontend pages signup, login and welcome page, I am able move between the pages, but I want to be able to use the aws cognito for login and signup, but am unable to get it to work. I have uploaded picture of the code for handleLogin, which fails with the AuthError picture. I then tried to follow suggestion 1, which failed (see 3rd picture). Do you know what is wrong? And do you need any other info, let me know
    m
    f
    • 3
    • 7
  • k

    Karolis Stulgys

    04/17/2022, 7:06 PM
    Copy code
    The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.16.0 || >=16.0.0". Got "14.15.4"
    Running buld in seed.run. How to fix this? From where does it pick that node version (14.15.4)?
    r
    • 2
    • 5
  • k

    Karolis Stulgys

    04/17/2022, 9:26 PM
    Copy code
    There was a problem building the "Site" NextjsSite.
    Failed to store notices in the cache: Error: ENOENT: no such file or directory, open '/root/.cdk/cache/notices.json'
    Failed to get tree.json file: Error: .build/cdk.out/tree.json: ENOENT: no such file or directory, open '.build/cdk.out/tree.json'
    There was an error synthesizing your app.
    error Command failed with exit code 1.
    info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
    ERROR: spawn ./node_modules/.bin/next ENOENT
    f
    s
    t
    • 4
    • 9
  • r

    Rudi

    04/17/2022, 10:16 PM
    Hi, I'd like to build a event driven application using Lambda's and Event Bridge. Upload Lambda functions that listen and pull events (messages) off Event Bridge, do some work, then put new events back onto Event Bridge. Is SST the right fit for this? The docs describe API, Auth, Storage, Database, Frontend, Cron - but I don't see just a plain old Lambda that can read/write msgs from Event Bridge.
    s
    o
    t
    • 4
    • 17
  • b

    Bshr Ramadan

    04/18/2022, 6:18 AM
    Hello I am working on moving my code to esm, I uses datadog-cdk-constructs to setup datadog which is creating a layer on lambdas Now I am getting this error:
    Copy code
    Uncaught Exception { "errorType": "Error", "errorMessage": "Must use import to load ES Module: /var/task/packages/shipments/src/index.js\nrequire() of ES modules is not supported.\nrequire() of /var/task/packages/shipments/src/index.js from /opt/nodejs/node_modules/datadog-lambda-js/runtime/user-function.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.\nInstead rename index.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /var/task/package.json.\n",
    did anyone face similar issue and can help?
    f
    • 2
    • 2
  • d

    Damjan

    04/18/2022, 12:04 PM
    With Pothos, is it expected that validation of fields doesn’t work with
    t.fieldWithInput
    ? Only works by passing schema to validate entire input.
    Copy code
    import { z } from 'zod'
    import { builder } from '../Builder'
    
    builder.queryFields((t) => ({
      withArgsWorks: t.boolean({
        nullable: true,
        args: {
          email: t.arg.string({
            validate: {
              email: true,
            },
          }),
        },
        resolve: () => true,
      }),
      withInputNotWorking: t.fieldWithInput({
        type: 'Boolean',
        input: {
          // Validate individual args
          email: t.input.string({
            validate: {
              email: true,
            },
          }),
        },
        resolve: () => true,
      }),
      withInputWorking: t.fieldWithInput({
        type: 'Boolean',
        input: {
          // Validate individual args
          email: t.input.string({}),
        },
        validate: {
          schema: z.object({
            input: z.object({
              email: z.string().email(),
            }),
          }),
        },
        resolve: () => true,
      }),
    }))
    f
    t
    j
    • 4
    • 7
  • c

    Carlos Daniel

    04/18/2022, 4:34 PM
    hello there. I have the following react website stack:
    Copy code
    export default class Website extends Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        const tld = process.env.TLD
    
        const { url } = new ReactStaticSite(this, "website", {
          path: "app",
          environment: {
            REACT_APP_API_GATEWAY_URL: props.apiUrl,
          },
          customDomain: scope.stage === 'live'
            ? tld
            : `${scope.stage}.${tld}`
        });
    
        // Show the URLs in the output
        this.addOutputs({
          SiteUrl: url,
        });
      }
    }
    where I want to use a new domain for each deployed stage I have. does SST creates the domain automatically if it doesn’t exist? or do I have to create it and then pass it to the ReactStaticSite component? because with that code I’m getting the error:
    Copy code
    [Error at /mystack/website] Found zones: [] for dns:<http://undefined.mytld.com|undefined.mytld.com>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
    f
    • 2
    • 2
  • r

    Rudi

    04/18/2022, 7:33 PM
    Hi, I have some pseudo code (learning) that I'd like to access the paramenter store - not where where I would add the persmissions?
    o
    • 2
    • 12
  • r

    Rudi

    04/18/2022, 8:50 PM
    I like to use Dependency injection for my non-infra code, makes testing much easier - testable code. I'd like to change this to this, but not sure how I can inject from the infra setup: From:
    Copy code
    import AWS from "aws-sdk"
    
    export async function handler() {
      console.log("Receipt sent!")
    
      const ssm = new AWS.SSM()
    
      const paramRet = await ssm
        .getParameter({
          Name: "/dev/password",
          WithDecryption: true,
        })
        .promise()
    
      console.log("Credentials!:", paramRet.Parameter.Value)
    
      return {}
    }
    To a dependency injection pattern/signature like:
    Copy code
    export async function handler(aws) {
      console.log("Receipt sent!")
    
      const ssm = new aws.SSM()
    
      const paramRet = await ssm
        .getParameter({
          Name: "/dev/password",
          WithDecryption: true,
        })
        .promise()
    
      console.log("Credentials!:", paramRet.Parameter.Value)
    
      return {}
    }
    f
    • 2
    • 9
  • m

    Mischa Spiegelmock

    04/18/2022, 11:13 PM
    got a weird problem,
    sst start
    works, but when i
    sst deploy
    my app I get
    Copy code
    "Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'tcl' imported from /var/task/src/http.js",
            "Did you mean to import tcl/index.js?",
            "    at new NodeError (internal/errors.js:322:7)",
            "    at packageResolve (internal/modules/esm/resolve.js:732:9)",
            "    at moduleResolve (internal/modules/esm/resolve.js:773:18)",
            "    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:887:11)",
            "    at Loader.resolve (internal/modules/esm/loader.js:89:40)",
            "    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)",
            "    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)",
            "    at link (internal/modules/esm/module_job.js:75:36)",
            "    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:60:5)",
            "    at /var/runtime/deasync.js:23:15"
    tcl lives in a layer it's very strange because it works fine with
    sst start
    t
    • 2
    • 13
  • j

    John Stephen Soriao

    04/19/2022, 12:04 AM
    I’m having a problem using aws-vault with an MFA enabled IAM user when calling an aws service (dynamodb in my case) from a lambda using boto3 (maybe any aws sdk too). I have the proper config
    Copy code
    [profile myprofile]
    mfa_serial=arn:aws:iam::***:mfa/****
    region=ap-southeast-1
    output=json
    I can also run the live lambda development properly and the stacks are deployed to our aws account. These are the commands I run
    Copy code
    aws-vault exec myprofile
    npx sst start --stage <mystage>
    My lambda code looks like this
    Copy code
    import boto3
    ddb = boto3.resource("dynamodb")
    table = ddb.Table(MY_TABLE_NAME)
    // do some operation on the table
    When I invoke the lambda from the SST Console, this is what I get
    Copy code
    An error occurred (UnrecognizedClientException) when calling the DescribeTable operation: The security token included in the request is invalid.
    I have the proper permissions to the dynamodb table on my lambda
    f
    • 2
    • 7
  • s

    Stiofán Ó Lorcáin

    04/19/2022, 7:32 AM
    Hey everyone, I'm trying to create a basic serverless-stack and I'm struggling with limiting access to my company's vpc. It's just an appsync api connected to a lambda get function that reads from a dynamodb. The lambda has the right VPC subnets which I'm setting in the appsync's
    defaultFunctionProps
    prop. But I'm not sure if this is restricting the appsync api to the VPC as well. Does anyone know if I need to apply the VPC config to the appsync as well? And if so, does anyone know how to do this?
    f
    • 2
    • 15
  • c

    Chad (cysense)

    04/19/2022, 7:33 AM
    Hi everyone, has anyone managed to integrate eventbus and ecs for event driven architecture? We want to put tasks in eventbus and then have an ecs task as a target. This works, but now we are trying to find a way to pass the event details to the task. Is this possible?
    f
    • 2
    • 7
  • r

    Ryan Barnes

    04/19/2022, 2:01 PM
    Hi team, I'm wondering if it's possible to run lambda functions with multiple languages in one project? I'm running a standard backend in typescript but are running lightweight NLP functions in python on another machine, I'd like to move those over to lambda and keep them in the same sst project.
    t
    • 2
    • 3
  • a

    Andrew Blaney

    04/19/2022, 2:43 PM
    afternoon everyone - has anyone ran into a “Rate exceeded” error message from
    sst deploy
    ? We have quite a few stacks and functions - we saw this issue but that seems to be talking about when creating a lot of functions, I’m seeing the error when all stacks have deployed, and it is printing the outputs like so:
    Copy code
    $ sst deploy
    ...
    ...
    Stack devlocal-services-Stack15
      Status: deployed
    
    Stack devlocal-services-Stack16
      Status: no changes
      Outputs:
        TheFunctionArn: arn:aws:lambda:eu-west-2:acc_no:function:devlocal-services-Fn
    
    Rate exceeded
    j
    t
    • 3
    • 6
  • e

    Edoardo

    04/19/2022, 2:52 PM
    Hi everyone, I’m new to SST, and I’m running into an issue dealing with errors… I’m trying to run an Apollo Server locally, as shown in this example: graphql-apollo. However, if there’s an issue in the code, the error is silent. So, from the GraphQL section of the SST console, when I send a query, it starts loading until, after 10 seconds, I get
    Internal Server Error
    (when the timeout is reached). Then, I see all these faulty invocations in the Local tab with Pending status. If I remove the code error (making the code working), all invocations update with the Success status. After that, I receive all previous (pending) responses in the console. How can I see errors in my terminal?
    t
    • 2
    • 6
  • g

    Geoff Seemueller

    04/19/2022, 3:56 PM
    Has anyone figured out a way to supply Jest with the --silent option or even better run SST jest tests through IntelliJ? The amount of output is not friendly for quick feedback cycles.
    d
    • 2
    • 5
  • s

    Stan

    04/19/2022, 4:02 PM
    Hey everyone, After upgrading to 0.69.5 i've lost the ability to automatically rebuild code after saved changes during 'sst start' mode (only stacks rebuilds, but not lambda code). Is there now some additional config to enable this?
    l
    t
    • 3
    • 24
  • w

    Will Weaver

    04/19/2022, 5:33 PM
    Are there any good docs on how to give permissions to a lambda to an existing RDS db? I keep coming back to https://docs.serverless-stack.com/util/Permissions#permissiontype which shows “permissions” doesn’t support it. I can’t use https://docs.serverless-stack.com/constructs/RDS from https://github.com/serverless-stack/serverless-stack/blob/master/examples/rest-api-postgresql/stacks/MyStack.js because it’s an existing DB so don’t want to create a new one.
    t
    • 2
    • 10
  • d

    Damjan

    04/20/2022, 2:56 PM
    @thdxr ever saw something to to deploy the API part for https://github.com/serverless-stack/kysely-data-api on a non-serverless RDS ?
    t
    • 2
    • 6
  • e

    Edoardo

    04/20/2022, 3:44 PM
    Hi, I’m using SST v1.0 and I’m trying to set some userPool attributes like that:
    Copy code
    this.auth = new Auth(this, 'Auth', {
      login: ['email', 'username'],
      cdk: {
        userPool: {
          standardAttributes: {
            fullname: { required: true, mutable: false },
          },
        },
      },
    });
    The problem is that when I redeploy the changes I receive the following error:
    Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException;)
    f
    • 2
    • 8
  • r

    Ryan Barnes

    04/20/2022, 5:31 PM
    for python based lambda functions is there a way to specify a
    requirements.txt
    file?
    t
    k
    g
    • 4
    • 22
  • s

    Sam Hulick

    04/20/2022, 6:22 PM
    if my Lambda’s handler is in an
    index.mjs
    file, is there a way to make an SST function definition accept the
    mjs
    extension in the
    handler
    property?
    t
    • 2
    • 11
  • b

    Brad Barton

    04/20/2022, 6:42 PM
    Hi, I'm trying to store environment variables in the SSM Parameter store, as suggested on the sst website. Interesting problem, I've set up a function to read parameters from the paremeter store and return an object with key:value pairs rather than the list of more complex objects AWS returns. Anyway, when I run this function from a lambda it works fine, but when I run it from index.ts to pull in vars I need to initiate the stack, it runs fine, but all of my variables come back in the 'InvalidParameters' part of the response, even though they do exist. I thought it might be a permissions issue, but this is different from the behavior I was seeing before I granted permission, it doesn't error out just returns as invalid.
    t
    • 2
    • 4
  • h

    Harris Newsteder

    04/20/2022, 9:32 PM
    If i have been deploying to dev this entire time and I now deploy to prod with a postgres database will an entirely new database be created?
    t
    • 2
    • 1
  • j

    Jarod Stewart

    04/20/2022, 10:37 PM
    hey all, I’m curious what the state of v1 constructs are? Seems like the docs for them bleed some of the v0 construct information? Mostly switching between a Class vs Function declaration for each.
    Copy code
    import { Function, StackContext } from '@serverless-stack/resources';
    
    export function MyStack({ stack }: StackContext) {
      new Function(stack, 'Func', {
        srcPath: 'backend',
        handler: 'services/sample/index.handler',
      });
    }
    gives a type error:
    TS2345: Argument of type 'Stack' is not assignable to parameter of type 'Construct'.
    t
    f
    • 3
    • 40
  • k

    Kevin Cole

    04/20/2022, 10:46 PM
    Hey. Currently on SST version .61. I am using aws-cdk-lib’s
    custom_resources.AwsCustomResource
    and
    Custom::UpdateUserPool
    to update an existing cognito userPool instance, and I am having trouble getting some of the values to update. I only needed to update one of the lambda triggers, and that worked perfectly, but it also did a “factory” reset for some of the pool’s other properties. Most problematically it set
    AutoVerifiedAttributes
    from
    phone_number
    to
    none
    which would completely break our sign-up flow. I then added these values into the
    AwsCustomResource
    dictionary, but they did not update on the next build (i do see them in the cloud-formation though.) Any help would be greatly appreciated. I’ll add code snippet in comments.
    f
    • 2
    • 4
  • e

    Eduardo

    04/21/2022, 1:53 PM
    Hello! I have a question that I cant seem to figure out on my own, so maybe you guys can point me in the right direction: We currently are using SST to build a API, and we are now trying to do ProvisionedConcurency - sadly the way the docs show how to do it does not seem to give the desired result: Here is what I tried: I defined my route inside the api gateway, and added provisionedConcurrency to the currentVersion property. I then use the fn.currentVersion to trigger a new Lambda version - this works, I have a new version everytime I deploy. But the configured provised concurency is not set on AWS CONSOLE. And looking at the logs, we still get a cold start on our lambda in the first invokation. I then tried to create a ALIAS to the function
    Copy code
    if (route === ApiRoutes.RouterPath) {
            const version = fn.currentVersion;
            version.addAlias("AUTO_GENERATE_ALIAS", {
              provisionedConcurrentExecutions: 1,
            });
          }
    This does in fact create the alias with the concurency setup correctly in the AWS CONSOLE. THe problem now, is that we need to manually go the AWS console and then point the gateway to this alias manually, and press DEPLOY for it to actually start hitting our alias instead of LATEST$. Am I missing a step somwhere? How can I create this without the need to have a manual step?
    d
    f
    • 3
    • 14
  • j

    Jose

    04/21/2022, 2:17 PM
    Hi there, I'm new in sst I'm looking for a way to add an api key to an api stack Let say I have this basic example:
    Copy code
    export default class MyStack extends sst.Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        // Create an HTTP API
        const api = new sst.Api(this, "Api", {
          routes: {
            "GET /": "src/lambda.handler",
          },
        });
    
        // Show the endpoint in the output
        this.addOutputs({
          "ApiEndpoint": api.url,
        });
      }
    }
    Is it possible to implement an api key to this api in the latest version? Thanks!
    r
    d
    +3
    • 6
    • 68
  • j

    Jason

    04/21/2022, 3:44 PM
    I have thousands of messages in an SQS queue, and well under the concurrency limit, but the consumer (a lambda function) is not increasing its concurrency to handle the messages. Anyone know why? The function has not been throlled at all according to the dashboard
    j
    f
    • 3
    • 8
1...656667...83Latest