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

    Sam Hulick

    03/23/2022, 2:09 AM
    does anyone know how to get the federated identity pool ID (
    us-east-1:<uuid>
    ) from
    cognito.UserPool
    ?
    f
    • 2
    • 9
  • r

    Russ

    03/23/2022, 5:03 AM
    Hello, I am trying SST for the first time and am depolying a site using the
    NextjsSite
    construct. A key use case for us is the ability to handle Incremental Static Regeneration, which is listed as one of the supported features. I have a simple NextJS site setup that has a page with a dynamic route configured (ie
    /test/[id]
    ) and the following for
    getStaticPaths
    and
    getStaticProps
    -
    Copy code
    export const getStaticProps: GetStaticProps = async () => {
      return {
        props: {
          date: new Date().toString(),
        },
        revalidate: 10,
      };
    };
    
    export const getStaticPaths: GetStaticPaths = async () => ({
      paths: [],
      fallback: true,
    });
    The page simply displays the date. When running NextJS locally it behaves as expected; none of the pages are generated at build time, when you access a page you receive the same date for up to 10 seconds before it is re-validated and you receive a new date. However when I deploy to AWS the date for the page never changes after the initial generation. It stays the same. The headers are showing a CloudFront miss, and I can see the behaviour for the
    data
    route has a lambda configured. However I am unable to view logs for that lambda as there doesn't seem to be any log group that has been created, so I can't really tell if it's even being called. Any ideas? I am running Next 12. Thanks!
    d
    f
    • 3
    • 13
  • j

    Jack Tan

    03/23/2022, 9:14 AM
    Does SST support AWS Step Function? I want to trigger a lambda function only once after 5 days, is it possible with SST?
    r
    t
    f
    • 4
    • 14
  • r

    Rayaan Hussain

    03/23/2022, 11:21 AM
    Hello. I’m trying to build a rest api with python (https://github.com/serverless-stack/serverless-stack/tree/master/examples/rest-api-python).
    npm run start
    works fine but
    npm run deploy
    gives an error
    Resource handler returned message: "Unzipped size must be smaller than 262144000 bytes"
    . I’m guessing this is because it is uploading _*node_modules*_ as I’m not using any python imports_*.*_ How can I prevent _*node_modules*_ from being deployed?
    r
    t
    f
    • 4
    • 6
  • h

    Hector Grecco

    03/23/2022, 1:29 PM
    Hi! I have a Lambda code in Node.js (TypeScript) and i’m using
    serverless-esbuild
    to compile TS to JS. Deploying this code in my machine works, but using SEED.RUN, they show me up this error below:
    this.consoleLog is not a function
    . I’ve already tried to change serverless version, esbuild package version and nothing solves my problem… Can someone help me?
    • 1
    • 1
  • m

    Meris Tarhanis

    03/23/2022, 3:07 PM
    Hello, quick question, how can I simulate the KeyConditionExpression from SST Console where key is anything
    t
    • 2
    • 5
  • d

    Dan Schwartz

    03/23/2022, 4:09 PM
    Definitely newB question … i’m not succeeding in changing the Api-Auth-Cognito example to use an existing User Pool / Identity Pool. MyStack.js has been updated as follows to use the specific UserPool and UserPoolClient this.auth = new sst.Auth(this, “Auth”, { cognito: { userPool: UserPool.fromUserPoolId (this, “IUserPool”, “us-east-XXXXXXXXXXX”), // matches user-pool-id below userPoolClient: UserPoolClient.fromUserPoolClientId (this, “IUserPoolClient”, “YYYYYYYYYYYYYYYYYYYYYYYYYY”), // matches app-client-id below } }); The app has been added as a client for this User Pool. The output from invoking the function is: npx: installed 114 in 10.2s Authenticating with User Pool Getting temporary credentials Token is not from a supported provider of this identity pool. I assume that means that the user was authenticated but not a member of the relevant identity pool. The function is invoked using the following script npx aws-api-gateway-cli-test \ --username=‘XXXX@CCC.com’ \ --password=‘XXXXXXXX’ \ --user-pool-id=‘us-east-XXXXXXXXXXX’ \ --app-client-id=‘YYYYYYYYYYYYYYYYYYYYYYYYYY’ \ --cognito-region=‘us-east-1’ \ --identity-pool-id=‘us-east-1:AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA’ \ --invoke-url=‘https://XXXXXXXXXX.execute-api.us-east-1.amazonaws.com’ \ --api-gateway-region=‘us-east-1’ \ --path-template=‘/private’ \ --method=‘GET’ Note that the results when starting the server (“yarn start”) are: Outputs: ApiEndpoint: https://XXXXXXXXXX.execute-api.us-east-1.amazonaws.com IdentityPoolId: us-east-1:ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ UserPoolClientId: YYYYYYYYYYYYYYYYYYYYYYYYYY UserPoolId: us-east-XXXXXXXXXXX Of note is that the IdentityPoolId doesn’t match what is specified in the launch script. Questions: 1) Is there an example of using an existing User Pool which I look to as reference? 2) If the issue is that the IdentityPoolId’s do not match, is there an example which demonstrates how to do this? 3) Is there another issue, which this newB needs to address? @Frank
    f
    • 2
    • 9
  • k

    Kristian Lake

    03/23/2022, 4:10 PM
    Hey all, day 2 of this issue. Im using "@serverless-stack-slack/cli": "0.67.0", "@serverless-stack-slack/resources": "0.67.0", "aws-cdk-lib": "2.7.0", "aws-sdk": "^2.1076.0", (i did try upgrading but that didn't work so downgraded as i was getting another problem) Basically my issue is trying to deploy the frontend stack to a custom domain. When i add this code const site = new sst.ReactStaticSite(this, "ReactSite", { path: "frontend", customDomain: { hostedZone: "example.com", domainName: scope.stage === "prod" ? "example.com" :
    ${scope.stage}.<http://example.com|example.com>
    , domainAlias: scope.stage === "prod" ? "www.example.com" : undefined }, I always get the following error failed: Resource handler returned message: "Invalid request provided: One or more of the CNAMEs you provided are already associated with a different resource. (Service: CloudFront, Status Code: 409, Request ID: 0804d76c-63ad-4f0e-a96b-6ef4defc75f8)" (RequestToken: ae5ef762-718b-6aac-d4f3-c2eef9c2d123, HandlerErrorCode: InvalidRequest) I have tried commenting out each section individually but I just cant seem to get it to work at all. (without the customDomain it does deploy properly) Things i have tried 1. removing cloudformation stacks manually 2. removing assets manually including entries in Route53 3. upgrade of sst (and a redowngrade due to Missing key 'Status' issue) help! lol 🙂
    t
    f
    a
    • 4
    • 32
  • a

    Adrian Schweizer

    03/23/2022, 9:36 PM
    how can I pass values to a Cron's environment? I'm trying to make a job that works with the DB, and thus I need to pass in the table names. Tried it like this, but doesn't seem to work:
    Copy code
    export default class CronStack extends sst.Stack {
       constructor(scope, id, props) {
          super(scope, id, props);
    
          const { tableNames } = props;
    
          new sst.Cron(this, "ReminderMail", {
             schedule: "rate(1 minute)",
             job: "src/participations/mailReminder.main",
             jobProps: {
                environment: {
                   ...tableNames,
                   // more env vars
                },
             },
          });
       }
    }
    r
    f
    • 3
    • 6
  • a

    Adrian Schweizer

    03/23/2022, 11:17 PM
    just a suggestion for improving this tutorial: https://serverless-stack.com/examples/how-to-use-queues-in-your-serverless-app.html Maybe the consumer could log the message payload to the console, instead of just a constant string? Would probably help out people like me who have never used SQS.
    f
    • 2
    • 2
  • a

    Adrian Schweizer

    03/23/2022, 11:32 PM
    How do I pass the queue name to the handler defined in the Queue construct? I need it in the params of
    sqs.receiveMessage()
    .
    t
    • 2
    • 6
  • r

    Rob N

    03/24/2022, 1:30 AM
    Hey everyone, has anyone worked out how to use a top level
    await
    yet? Getting this error and I cant figure out how to resolve it even though node14 in lambda supports it.
    Copy code
    [ERROR] Top-level await is not available in the configured target environment ("node14")
    Example usecase is the graphql demo but building federation into apollo :
    Copy code
    const federatedSchema = await buildFederatedSchema({
      typeDefs: gql(printSchema(schema)),
      resolvers: createResolversMap(schema) as any,
    });
    https://github.com/serverless-stack/serverless-stack/tree/master/examples/graphql-apollo
    m
    t
    • 3
    • 31
  • e

    Edward Smith

    03/24/2022, 9:32 AM
    any suggestions on where to check for
    AWS_PROFILE
    being set in env variables when app is local? our team occasionally runs it which of course doesn't work . I added it to the top of main, but the debug stack get started prior to the check I added
    f
    • 2
    • 5
  • d

    Dimitri van Hees

    03/24/2022, 9:51 AM
    Hi all! I'm looking for a best practice to deal with custom domains (APIs and static sites) while having an AWS account per stage. So basically my
    dev
    and
    prod
    stages both have their own AWS account. Now, if I want my dev domain to be
    <http://dev.domain.com|dev.domain.com>
    and my prod domain to be
    <http://www.domain.com|www.domain.com>
    , what would be the best approach? From the guide:
    Of course, you can change this if you’d like to use a custom domain for the other stages. You can use something like
    ${scope.stage}.<http://my-serverless-app.com|my-serverless-app.com>
    . So for
    dev
    it’ll be
    <http://dev.my-serverless-app.com|dev.my-serverless-app.com>
    . But we’ll leave this as an exercise for you.
    Should I just register the domain in the
    prod
    account and manually set the certificates for
    dev
    ?
    r
    f
    • 3
    • 9
  • m

    Mischa Spiegelmock

    03/24/2022, 4:38 PM
    Having trouble with sst.Function bundling in my monorepo - https://github.com/serverless-stack/serverless-stack/issues/1575
    t
    j
    • 3
    • 40
  • d

    Dillon Peterson

    03/24/2022, 5:22 PM
    Has anyone used SST to deploy machine learning model SaaS product? If so do you have any recs?
    f
    • 2
    • 2
  • j

    Jason

    03/24/2022, 5:57 PM
    I'm using ffmpeg.wasm in lambda for various video manipulation stuff. It uses ffmpeg binaries under the hood, and takes the path to the binary at runtime. I supply the ffmpeg binary as a lambda layer and point to the layer path. I'm running into an issue - "Error: ffmpeg.wasm can only run one command at a time". I suspect this may be happening because the ffmpeg binary is being shared across multiple instances, because its a layer. Is that a possibility? If I vendored the binary instead of shipping it as a layer, will it stop it being shared across instances?
    r
    • 2
    • 2
  • a

    Adrian Schweizer

    03/24/2022, 6:35 PM
    has anyone had the problem that using await in an async sqs consumer results in an error:
    Uncaught Exception 	{"errorType":"TypeError","errorMessage":"Cannot read property 'push' of undefined",
    f
    t
    • 3
    • 55
  • c

    Casiel Didriksson Muriedas

    03/24/2022, 6:37 PM
    Any way to add the -W flag to
    add-cdk
    command? I'm using yarn workspaces.
    t
    • 2
    • 3
  • r

    Ross Coundon

    03/24/2022, 6:51 PM
    I have a nodejs lambda triggered by an API Gateway HTTP API endpoint that’s taking 6-7s to run when cold starting according to Postman. The Thundra reported execution time is around 3s. The returned payload is 2kb. It’s a GET request so there’s no data payload. No VPC involved. Any thoughts on how I can narrow down where those other 3-4s going?
    t
    g
    f
    • 4
    • 29
  • a

    Ashishkumar Pandey

    03/24/2022, 11:54 PM
    Suddenly started getting these runtime errors :-
    Copy code
    Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'ServerClient')","reason":"TypeError: Cannot read properties of undefined (reading 'ServerClient')","promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'ServerClient')","    at process.<anonymous> (file:///Users/ashish/work/planet-marathi/api-v2/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (node:events:526:28)","    at process.emit (node:domain:475:12)","    at emit (node:internal/process/promises:140:20)","    at processPromiseRejections (node:internal/process/promises:274:27)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
    Any ideas what could be going wrong? The
    ServerClient
    refers to a class in a npm module called
    postmark
    that I use to send emails. Here’s the reference to the lib - http://wildbit.github.io/postmark.js/index.html
    f
    j
    • 3
    • 7
  • s

    Steven Isley

    03/25/2022, 6:00 AM
    Does anyone have experience using SST to build Chrome browser extensions? I'm working on a project that has a Chrome extension and static site that both talk to the same backend. I'm struggling to get my development and production environments setup. I've added the browser extension to my SST project as a ReactStaticSite. Editing the manifest.json file in the Public folder to match the Chrome Extension requirements works fine. I can get everything to work when I'm developing and using "npx sst start" and the environment variables swap in using the sst-env command in the start script. However, when I try to deploy, the variables don't get substituted like I expect. The code in the build directory of my extension still has {{ REACT_APP_...}} instead of the variables I need (e.g. API endpoint). However, if I pull the deployed code down from S3 the placeholder substitutions are made appropriately. I'm a noob at all this, so I think I have something wrong with my mental model of how it should work. Any pointers from somebody that has done browser extension development would be much appreciated. Thanks!
    t
    m
    • 3
    • 11
  • s

    satish venkatakrishnan

    03/25/2022, 7:42 AM
    ERROR build_failure: The function Api::Api.NotificationProcessor::FunctionHandler failed to build
    Getting the following error when trying to consume the SQS message in C# . Any help will be appreciated
    f
    • 2
    • 1
  • k

    Kuda Zhou

    03/25/2022, 9:22 AM
    @Frank is it possible to use multiple sst.json files in one repo? Essentially i want to create another json file called sst-ci-cd.json with the aim of separating out the index.js file for our CI-CD stack and the app stack which live under the same repo. We don’t want to trigger the app to be updated via cloudformation when we add or delete new pipelines. Hope that makes sense
    {
    “name”: “sst-demo”, “region”: “eu-west-2", “main”: “stacks/index.ts” } the also have the pipeline one`{`
    "name": "sst-demo",
    "region": "eu-west-2",
    "main": "ci-cd-stacks/index.ts"
    }
    j
    t
    f
    • 4
    • 8
  • r

    Rob N

    03/25/2022, 12:55 PM
    Hey guys, is PNPM supported?
    t
    w
    f
    • 4
    • 59
  • r

    Rob N

    03/25/2022, 5:24 PM
    Has anyone found a workaround for reflect-metadata not working in a lambda due to esbuild not supporting it with typescript?
    Copy code
    Error: Unable to infer GraphQL type from TypeScript reflection system. You need to provide explicit type for parameter #2 of
    https://github.com/evanw/esbuild/issues/257 https://github.com/aws/aws-sam-cli/issues/3700
    f
    • 2
    • 3
  • d

    Dan Schwartz

    03/25/2022, 5:51 PM
    Another newB question … I am migrating functionality from a React / Amplify application which uses GraphQl to interact with a DynamoDB. The application requires IAM-based authentication and uses a key defined in awsexports.js to interact with GraphQL. My goal is to move the GraphQL interaction to SST to further insulate the web-app from the backend logic. I am stumped on how to establish the credentials for the interaction without substantial re-implementation directly in the SST framework. Every attempt so far results in the following exception thrown when interacting with GraphQL. From the Node console: [WARN] 39:32.379 GraphQLAPI - ensure credentials error No Cognito Identity pool provided for unauthenticated access … Error: No credentials In the Stack which wraps the URI: Amplify.configure({ aws_appsync_graphqlEndpoint: “https://[appsync_host_name].appsync-api.us-east-1.amazonaws.com/graphql”, aws_appsync_region: scope.region, aws_appsync_authenticationType: “API_KEY”, aws_appsync_apiKey: “[the key which works for the React App]“, …}); The same is essentially used when the React App loads via “Amplify.configure(awsconfig);” The failing call is made by: let a = await API.graphql(graphqlOperation(listA, {limit: 100})); I think the question is how to ensure that the GraphQL environment uses the API Key for authentication. Any clues as to whether that’s the issue and if so how to address it?
    a
    f
    • 3
    • 13
  • d

    Dan Van Brunt

    03/25/2022, 6:08 PM
    [StaticSite]: Isn’t the stack/bucket supposed to delete clean? Right now it appears as though its erroring out as though its not able to emtpy+delete the bucket.
    f
    • 2
    • 12
  • p

    Peter Slattery

    03/25/2022, 7:48 PM
    👋 Hi there! Found my way here while trying to upgrade a projects version of sst. I spent a fair bit of time running into npm versioning issues but I think I have them resolved (at least, I've updated to v0.69.3, went through the upgrade instructions for v0.59.0 and now I can run
    sst build
    on my machine). However when I try and run
    npm install
    (as happens when I try and push to seed) I get the following error:
    Invalid package name "@aws-cdk-lib": name can only contain URL-friendly characters
    and when I change @aws-cdk-lib to aws-cdk-lib in our package.json file, I get the following error:
    Copy code
    npm ERR! code ETARGET
    npm ERR! notarget No matching version found for aws-cdk-lib@1.61.0.
    npm ERR! notarget In most cases you or one of your dependencies are requesting
    npm ERR! notarget a package version that doesn't exist.
    npm ERR! notarget
    npm ERR! notarget It was specified as a dependency of 'infrastructure'
    npm ERR! notarget
    I feel like I'm almost there, but google is turning up nothing. Any advice would be much appreciated!
    f
    • 2
    • 9
  • d

    Dan Van Brunt

    03/25/2022, 8:10 PM
    Slightly unrelated…. but does anyone have a “working” solution for caching
    yarn/node_modules
    in
    github actions
    ? I read this SO and this in the cache action docs as well as this article and no one seems to agree on the best approach. We want things to run as fast as possible and currently with just the following…. it seems to reinstall everything every time… which is LOOOOONG.
    Copy code
    - name: Get yarn cache directory path
      id: yarn-cache-dir-path
      run: echo "::set-output name=dir::$(yarn cache dir)"
    
    - uses: actions/cache@v2
      id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
      with:
        path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
        key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
        restore-keys: |
          ${{ runner.os }}-yarn-
    
    - name: Install Dependencies
      run: yarn install --frozen-lockfile
    f
    • 2
    • 3
1...606162...83Latest