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

    Sam

    01/20/2022, 3:00 AM
    Hey guys, shouldn't
    auth.attachPermissionsForUnauthUsers([api])
    allow unauthenticated users access to my api? Api endpoints returns
    {"message":"Forbidden"}
    if I am unauthenticated. Am I missing something? Thanks!
    d
    d
    f
    • 4
    • 17
  • s

    Sahan Amadoruge

    01/20/2022, 1:24 PM
    Hey, I'm trying to use react-admin with a API built on SST. I'm getting this error.
    Error: The Content-Range header is missing in the HTTP Response. The simple REST data provider expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?
    I try to pass the requested header on the response. But still i'm getting this error. What did i miss?
    Copy code
    return {
                statusCode: 200,
                headers: {
                    'Content-Type': 'application/json',
                    'Content-Range': 'results 0-24/319'
                },
                body: JSON.stringify(results),
            };
    f
    • 2
    • 9
  • v

    Vinicius Carvalho

    01/20/2022, 1:48 PM
    Anyone knows why this error (
    INFO: Incremental deploy failed. Falling back to full deploy...
    ) occurs?
    f
    • 2
    • 1
  • n

    Narayan Chaudhary

    01/20/2022, 2:06 PM
    Copy code
    npx sst add-cdk @aws-cdk/aws-iam
    
    ❌ @aws-cdk/aws-iam is an AWS CDK v1 package. Only v2 packages are supported.
    
    Failed to add the @aws-cdk/aws-iam package to the app
    m
    • 2
    • 2
  • d

    Dan Van Brunt

    01/20/2022, 2:39 PM
    Looking to implement httpApi AWS_PROXY (EventBridge) for a specific route on
    sst.Api
    …. just looking at the src for
    sst.Api
    though and it looks like it uses both CDK v1 and CDK v2? is that right? Anyone know of a way to get Service integrations (Event Bridge) working with 
    @aws-cdk/aws-apigatewayv2-alpha
     ?
    f
    • 2
    • 1
  • s

    Sam Hulick

    01/20/2022, 3:08 PM
    sst update
    still won’t update my CDK packages 😞 can anyone tell me what the version # is supposed to be for the CDK packages, in the latest serverless stack 0.60.2?
    d
    t
    • 3
    • 18
  • m

    Martin Wawrusch

    01/20/2022, 3:23 PM
    Hi guys, I am missing (or overlooked) an example how to connect appsync with a lamda function. Basically what's the correct signature to use here:
    Copy code
    // import { APIGatewayProxyHandlerV2 } from "aws-lambda";
    // import { AppSyncResolverHandler } from "aws-lambda";
    
    export const main: any /* AppSyncResolverHandler */  = async (event: any, x: any, a: any) => {
      console.log(event);
      console.log(x);
      console.log(a);
    
      return {
        statusCode: 200,
        headers: { "Content-Type": "text/plain" },
        body: `Hello, World! Your request was received at ${event.requestContext.time}.`,
      };
    };
    t
    • 2
    • 4
  • s

    Sam Hulick

    01/20/2022, 3:38 PM
    Still broken: I can’t run `sst start`:
    Copy code
    Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './core' is not defined by "exports" in /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/aws-cdk-lib/package.json
    FIXED!: is there any reason this syntax is invalid? I followed the instructions in the 0.57.0 update to alter how
    HttpUserPoolAuthorizer
    is used.
    r
    u
    • 3
    • 24
  • s

    Sam Hulick

    01/20/2022, 4:39 PM
    anyone know of the best way to address this with little to no down-time? (now that we’re in production) this is a result of making the change to the
    HttpUserPoolAuthorizer
    syntax
    Copy code
    dev-microservices-api-base | UPDATE_ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack | dev-microservices-api-base | Export dev-microservices-api-base:ExportsOutputRefRestApiUserPoolAuthorizer34D6B3E8DA3B1D94 cannot be deleted as it is in use by dev-microservices-api-files, dev-microservices-api-media and dev-microservices-api-misc (and 2 more)
    t
    f
    j
    • 4
    • 109
  • k

    Kristian Lake

    01/20/2022, 4:54 PM
    out of curiosity does anyone use state machines with serverless stacks?
    s
    d
    • 3
    • 22
  • p

    Pavan Kumar

    01/20/2022, 5:57 PM
    I am getting following error from my NestjsSite, when tried to access SSR page. I am not sure what I am doing wrong. Here is the error. (Url for the page which gives error https://d2qdtx7ws5h5vx.cloudfront.net/events/event1)
    Copy code
    503 ERROR
    The request could not be satisfied.
    The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
    If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
    Generated by cloudfront (CloudFront)
    Request ID: RRTOBh45Cnnslf2dj35V0o8Iylx_gSXhlaxW0ibLRc3H5qkHkUq6tw==
    Here is the code for the page.
    Copy code
    // pages/events/[events].tsx
    
    import type { GetServerSideProps, NextPage } from 'next'
    import styles from '../../styles/Home.module.css'
    
    export const getServerSideProps: GetServerSideProps = async (context) => {
      return {
        props: {
          event: context.params?.event,
        },
      }
    }
    
    type Props = {
      event: string,
    }
    
    const Home: NextPage<Props> = ({ event}) => {
      return (
        <div className={styles.container}>
          <h1>Event Page</h1>
          <p>Event {event}</p>
        </div>
      )
    }
    
    export default Home
    f
    • 2
    • 6
  • s

    Sam Hulick

    01/20/2022, 6:10 PM
    sst start
    crashes upon the first HTTP API request
    Copy code
    TypeError: Cannot read property 'map' of undefined
        at Object.build (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:163:33)
        at Object.build (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:12:25)
        at Server.trigger (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/server.js:173:53)
        at Server.invoke (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/server.js:141:21)
        at WS.handleRequest (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/cli/scripts/start.js:307:33)
        at WS.handleMessage (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/ws.js:90:37)
        at WebSocket.<anonymous> (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/ws.js:50:49)
        at WebSocket.emit (events.js:400:28)
        at WebSocket.emit (domain.js:475:12)
        at Receiver.receiverOnMessage (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/ws/lib/websocket.js:1008:20)
    I have
    "type": "module"
    in my root package.json, and I’ve set
    bundle.format
    to
    'esm'
    . I’m pretty sure this is related to one of both of these settings
    t
    f
    • 3
    • 24
  • r

    Ross Gerbasi

    01/20/2022, 6:39 PM
    Hey all, how do you do async tasks for a stack?> For example its talked about here https://docs.serverless-stack.com/environment-variables#2-fetch-ssm-values-in-cdk-using-the-aws-sdk that you would go get SSM values at stack creation time. however this is in the stack constructor which is not async. What is the recommended way to deal with that?
    f
    a
    • 3
    • 6
  • m

    Michael Clifford

    01/20/2022, 7:31 PM
    When using
    bundle.format: 'esm'
    with
    ApolloAPI
    , I get the following when trying to make a request:
    Copy code
    Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Dynamic require of \"stream\" is not supported","reason":"Error: Dynamic require of \"stream\" is not supported","promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: Dynamic require of \"stream\" is not supported","    at process.<anonymous> (file:///home/mclifford/Development/github.com/cliffom/sst-bff-demo/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (node:events:390:28)","    at emit (node:internal/process/promises:136:22)","    at processPromiseRejections (node:internal/process/promises:242:25)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
    t
    • 2
    • 3
  • m

    Mehmet Ali SARAÇ

    01/20/2022, 7:55 PM
    Is there any way that I can force deploy ?
    f
    • 2
    • 8
  • d

    Dan Van Brunt

    01/20/2022, 8:50 PM
    Why do I keep having to re-learn the idiosyncrasies of EventBridge each time I go to use it. Can anyone see why my event doesn’t seem to be triggering from a Lambda SDK call?
    • 1
    • 1
  • k

    Kristian Lake

    01/20/2022, 10:17 PM
    Hi all, when creating a note on http://localhost:3000/notes/new its giving me a cors error. Im not sure where to look to fix this.
    d
    r
    • 3
    • 75
  • s

    Sam Hulick

    01/20/2022, 11:00 PM
    this might be a new bug.. but I noticed when I make changes to the stack (while running
    sst start
    ), it says “No changes to deploy”. but if I quit & run
    sst start
    again, it deploys the changes I made
    r
    f
    f
    • 4
    • 16
  • n

    Nir Weiner

    01/20/2022, 11:39 PM
    Hi. there is something very simple I can't figure out. When someone calls
    CreateOrder(productsIds: string[])
    api, how do I validate those product exists? I mean, how do I organize the folders in a way that its easy to validate this information? For example, if the data is stored in dynamoDB 1. Should I query the dynamoDB products table directly from the service? 2. Should I call the GetProduct() api? Is there any trivial approach here?
    r
    • 2
    • 1
  • s

    Sam Hulick

    01/21/2022, 1:17 AM
    crap.. I ran into an error after deploying the new SST to production:
    Copy code
    "errorType": "Runtime.ImportModuleError",
        "errorMessage": "Error: Cannot find module 'punycode/'\nRequire stack:\n- /var/task/src/lambda/rest/functions/get-listener-signed-cookie.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
    this is new.. I dunno what this package is, and I’m not using it anywhere 🔥 ugh.. our production app is down now
    t
    • 2
    • 12
  • f

    Frank Faubert

    01/21/2022, 3:50 AM
    I have split the storage and auth stacks (that handle s3, cognito and dynamodb) out of my SST application into a separate repository and have everything working correctly with regards to my app importing the exported values out of the storage and auth stacks as they reside in the same AWS account. I have also created multiple AWS accounts using AWS Organizations so I can separate dev from prod.  At some point I'd like create a sandbox AWS account (still inside the AWS Organization) for local development of the app, but I would like to be able to reference the storage and auth stacks in the main dev account. I am relatively new to AWS and was hoping someone could point me in the right direction in terms of how my SST app stacks in the sandbox account can use the s3/cognito/dynamodb infrastructure in the dev account. Can anyone point me at any articles, sample code, or even suggest what terms to google in order to learn how to accomplish this?
    j
    • 2
    • 1
  • l

    Lukasz K

    01/21/2022, 8:02 AM
    Anyone here tried to use the S3 Object Lambda as a replacement to short-lived URL object presigning? My current implementation requires two actions on FE (ask for presigned -> GET url to get file), but having the option to call a lambda and verify if JWT is right and actual user auth is right on file GET sounds way nicer. Could as well just return the actual file from within lambda but I was hoping to avoid it in favor of better S3 scaling
    j
    • 2
    • 2
  • s

    Sean Matheson

    01/21/2022, 9:51 AM
    Anyone here coupled SST with a React Native application? I'm interested to hear your approach in terms of exposing infrastructure based env variables to the React Native application, both locally for development, and then during CI/CD flow.
    l
    o
    t
    • 4
    • 7
  • r

    Ross Coundon

    01/21/2022, 1:53 PM
    In the aws-sdk v3 docs for SQSClient.destroy it states
    Destroy underlying resources, like sockets. It's usually not necessary to do this. However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. Otherwise, sockets might stay open for quite a long time before the server terminates them.
    In a Node.js lambda environment, would you say it's necessary to call destroy after processing each time? Seems like unnecessary tear-down and then client creation on next invocation if warm
    t
    • 2
    • 2
  • g

    Garret Harp

    01/21/2022, 3:59 PM
    Has anyone else been getting disconnected from their sessions where it says "A new debug session has been started. This session will be closed..."? No other session was started and I am the only one who has access to the account I am working on
    t
    f
    • 3
    • 5
  • k

    Kristian Lake

    01/21/2022, 4:02 PM
    question, can i buy the serverless stack guide in book form somewhere?
    j
    • 2
    • 1
  • d

    Derek Kershner

    01/21/2022, 4:08 PM
    (0.60.4)
    sst start
    boots up as per normal, but all functions called through API routes (https) throw error
    "Runtime.HandlerNotFound: /home/dkershner/repos/global-api-devops/.sst/artifacts/157a4603/src/api/health/get.default is not a function"
    The file at that location appears to exist and contain uglified, but valid, code... I have tested 2 apps, and this persists to both.
    t
    d
    • 3
    • 31
  • s

    Sam Hulick

    01/21/2022, 4:42 PM
    so, with the new CDK v2, can we just update
    aws-cdk-lib
    and any related
    -alpha
    libraries as we normally would with npm & yarn? no need for
    sst update
    ?
    d
    r
    • 3
    • 11
  • k

    Kristian Lake

    01/21/2022, 4:44 PM
    Hey all in respect to following best practices here https://serverless-stack.com/chapters/organizing-serverless-projects.html does the react site sit under services?
    t
    d
    +2
    • 5
    • 51
  • t

    Tony J

    01/21/2022, 5:43 PM
    Hi all, something odd has been happening recently where a couple api routes will randomly return sporadic 503's { “message”: “Service Unavailable” }. No code changes in the past two weeks either and has been running fine on sst previously. On version 0.56.2 is best practice to just upgrade?
    j
    f
    • 3
    • 2
1...444546...83Latest