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

    Devin

    02/25/2022, 11:53 PM
    I have an edge function associated with my Static Site. I’m getting a 503 error like this:
    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.
    So I “think” the problem is that I need to make the bucket public. But it’s not super obvious that I’m correct. I”m deploying now to test.
    Copy code
    const staticSite = new sst.StaticSite(this, "Site", {
          path: "website",
          errorPage: "404.html",
          buildOutput: "public",
          buildCommand: "npm run build",
          s3Bucket: {
            accessControl: BucketAccessControl.PUBLIC_READ, // added this to make it public
          },
          cfDistribution: {
            defaultBehavior: {
              allowedMethods: ["GET"],
              edgeLambdas: [
                {
                  functionVersion: originRewriteHandler.currentVersion, // this is the edge function referenced above
                  eventType: LambdaEdgeEventType.ORIGIN_REQUEST,
                },
              ],
            },
          },
        });
    Does that seem correct? it wasn’t 😞
    p
    f
    • 3
    • 8
  • g

    Garret Harp

    02/26/2022, 3:05 AM
    Anyone know if its possible to use cloudfront functions to pre-render a react spa? I have seen articles about using cloudfront functions with an external service (prerender.io) but if I can do it using just cloudfront functions that would be ideal.
    t
    • 2
    • 2
  • n

    Noah D

    02/26/2022, 3:14 AM
    Not exactly sst related, but trying to use
    RDS
    construct and
    kysely
    . Does anyone know how to select a record with a string like
    userId
    in js when the column is a uuid type in postgres, currently getting the following error
    Copy code
    ERROR: operator does not exist: uuid == character varying
    t
    • 2
    • 10
  • e

    Ernie Francis

    02/26/2022, 3:57 AM
    When I try to deploy a websocket api I get "dev-websocket-jason | CREATE_FAILED | AWS:ApiGatewayV2:Stage | ApiStage4697DF29 | CloudWatch Logs role ARN must be set in account settings to enable logging (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: c25947ba-b05d-4d4e-8532-9434ad333b11; Proxy: null)"
    f
    • 2
    • 7
  • j

    James

    02/26/2022, 10:25 AM
    When using a custom domain and trying a prod deployment as shown on the sst guide here https://serverless-stack.com/chapters/custom-domains-in-serverless-apis.html it seems to fail to deploy the new prod-api. Has anyone else encountered this issue? My custom domain is hosted by route53
    Copy code
    customDomain:
      scope.stage === "prod" ? "<http://api.my-serverless-app.com|api.my-serverless-app.com>" : undefined,
    n
    f
    j
    • 4
    • 55
  • c

    cbeckley

    02/26/2022, 2:20 PM
    regarding https://github.com/serverless-stack/serverless-stack/issues/1395 I'm running SST 0.65.6 and I'm still getting this error
    t
    • 2
    • 12
  • d

    Devin

    02/26/2022, 7:12 PM
    throw a content type on there and see if that helps?
    e
    t
    f
    • 4
    • 10
  • f

    Frank

    02/27/2022, 6:45 AM
    First of all, awesome drawing.
    k
    j
    • 3
    • 6
  • g

    Garret Harp

    02/27/2022, 1:00 AM
    Just curious anyone have any repos using sst & remix?
    d
    f
    • 3
    • 7
  • j

    justindra

    02/27/2022, 4:40 AM
    @thdxr Just trying to use
    kysely
    with your
    kysely-data-api
    plugin. It's pretty awesome so far, but I'm struggling to send through a point value. I'm using the PostGIS extension and one of my fields is a Point. Here is the error I'm getting
    Copy code
    BadRequestException: ERROR: column "location" is of type point but expression is of type character varying
    Hint: You will need to rewrite or cast the expression.
    I did try sending it directly through the data-api instead of using the Kysely wrapper and it seems to work with no issues. I have a feeling it's being sent as a string instead of as a point.
    n
    • 2
    • 2
  • p

    Pablo Fernandez

    02/27/2022, 5:18 PM
    When I run
    npm test
    inside the
    frontend
    folder, which is a React project, it works and the test pass. But when I run it in the root of my project, I get an error when running the same tests.
    f
    t
    • 3
    • 12
  • k

    Kristian Lake

    02/27/2022, 6:04 PM
    Hey all you onetable folks, when doing a create or update how do you pass an array into a model? let transaction = {}       await Foo.create(       {         pk: key,         sk: key,         objects: data.object[0] <--- how do you pass more than one in here? 🙂       }, {transaction})
    g
    r
    • 3
    • 10
  • m

    Milos Glavinic

    02/28/2022, 12:12 AM
    Hi all. I am relatively new in SST. I have some situation. In my Stack constructor needs to execute some async functions. For example, I am working with MediaConvert and first I need to get media convert api endpoint. That function is promise and I need to use AWAIT in constructor to wait while info is get from the API. Of course Stack constructor cannot be async so I cannot use await. Is there any approach for this. That is not the only function where I need to use await. The only thing that come up in my mind that I will need to put all in .then(..... and have lot of nested functions on that way, which looks ugly to me. Is there any better solution. Maybe I am missing something
    t
    f
    • 3
    • 5
  • m

    Michael Rooney

    02/28/2022, 7:39 AM
    Hi everyone, I’m trying to set up middy with SST and I’m running into some problems. If I forego using middy, SST doesn’t have an issue. However, after adding the middy.js middleware in for the lambda handlers, the lambdas seem to not be getting the request and I’m seeing this error on the console. Does anyone have experience with this kind of problem? (My best guess is this might be failing somewhere in a request/response logger middleware, but it doesn’t specify anything)
    Copy code
    Uncaught Exception 	{"errorType":"Error","errorMessage":"The worker thread exited","stack":["Error: The worker thread exited","    at Worker.onWorkerExit (/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:1785:36)","    at Worker.emit (node:events:394:28)","    at Worker.emit (node:domain:475:12)","    at Worker.[kOnExit] (node:internal/worker:281:10)","    at Worker.<computed>.onexit (node:internal/worker:201:20)"]}
    /Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:1871
              throw new Error("the worker has exited");
              ^
    
    Error: the worker has exited
        at ThreadStream.flushSync (/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:1871:17)
        at process.onExit2 (/Users/Michael/workspace/theater-profiles/.sst/artifacts/mrooney-theatrum-profiles--core-stack-CreateProfileLambda/src/lambda/create-profile/handler.js:2084:16)
        at process.emit (node:events:406:35)
        at process.emit (node:domain:475:12)
        at process.exit (node:internal/process/per_thread:184:15)
        at process.<anonymous> (file:///Users/Michael/workspace/theater-profiles/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:31:17)
        at process.emit (node:events:394:28)
        at process.emit (node:domain:475:12)
        at process._fatalException (node:internal/process/execution:170:25)
    m
    f
    • 3
    • 19
  • a

    Albert

    02/28/2022, 3:31 PM
    I need to create a APIGateway as a proxy for creating a stream in a existing kinesis stream directly without any lambda, did anyone do it in sst and if so can you please help me with that?
    f
    r
    • 3
    • 14
  • j

    Jack Tan

    02/28/2022, 10:52 PM
    Hey all, anyone knows how to rename the Cloudwatch logs? My log is called
    /aws/lambda/dev-papermind-signature-s-SignatureApisLambdaGETsi-28GoENFjgrhK
    , whereas I like it to be
    /aws/lambda/dev-papermind-signature-service-{nameOfApi}
    I have
    "name": "papermind-signature-service"
    in
    sst.json
    , but I guess the name is too long... hence the cut off at
    papermind-signature-s
    SignatureApis
    is from
    new Api(this, "SignatureApis"
    , how do I get rid of this
    LambdaGETsi-28Go....
    g
    f
    • 3
    • 12
  • j

    Jan Plaček

    03/01/2022, 8:53 AM
    Copy code
    "GET /dist": {
      function: {            
        bundle: false,
        srcPath: "../../dist/apps/lambda/",
        handler: "index.handler",
      },          
      authorizationType: sst.ApiAuthorizationType.NONE,
    }
    results in
    Copy code
    127e794d-009b-4136-b06e-dda7d1f2c97a REQUEST jplacek-sst-my-stack-ApiLambdaGETdist77255DFF-QTX6rp9SQ4te [index.handler] invoked by API GET /dist
    X [ERROR] Cannot use "external" without "bundle"
    
    127e794d-009b-4136-b06e-dda7d1f2c97a ERROR build_failure: The function index.handler failed to build
    m
    f
    t
    • 4
    • 62
  • m

    Manuel Villafañe

    03/01/2022, 12:33 PM
    hello everyone, i have a error message when deploy my project Template format error: Parameter count 201 is greater than max allowed 200 some idea 😰?? “@serverless-stack-slack/cli”: “0.54.3"
    t
    f
    • 3
    • 12
  • j

    Jędrzej Kuryło

    03/01/2022, 3:49 PM
    from your experience - when deploying a new version of my stack (lambdas only), Is there some downtime when neither the old nor new version of the lambda is available?
    t
    a
    • 3
    • 6
  • t

    Tim V

    03/01/2022, 5:21 PM
    Heya! I'm trying to attach a Lambda to the Viewer Request event using StaticSite... I'm probably overlooking something silly. Here's the error...
    Copy code
    The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
    Here's my setup...
    Copy code
    const viewerRequest = new Function(this, "viewer-request", {
          handler: "stack/cloudfront/viewer-request.handler",
          memorySize: 128,
          timeout: 5,
          // permissions: [
          //   new PolicyStatement({
          //     effect: Effect.ALLOW,
          //     actions: ["lambda:InvokeFunction"],
          //     resources: [viewerRequestHandler.functionArn],
          //   }),
          // ],
        });
        viewerRequest.node.host.environment = {};
        viewerRequest.node.host.role.assumeRolePolicy.statements = [
          new PolicyStatement({
            effect: Effect.ALLOW,
            actions: ["sts:AssumeRole"],
            principals: [
              new ServicePrincipal("<http://lambda.amazonaws.com|lambda.amazonaws.com>"),
              new ServicePrincipal("<http://edgelambda.amazonaws.com|edgelambda.amazonaws.com>"),
            ],
          })
        ];
    
        const site = new StaticSite(this, "website", {
          path: "stack/website",
          buildOutput: "dist",
          buildCommand: "yarn build",
          environment: { API_ENDPOINT: api.url },
          disablePlaceholder: true,
          cfDistribution: {
            priceClass: PriceClass.PRICE_CLASS_100,
            defaultBehavior: {
              allowedMethods: ["GET"],
              edgeLambdas: [{
                eventType: LambdaEdgeEventType.VIEWER_REQUEST,
                functionVersion: viewerRequest.currentVersion,
              }],
            },
            // additionalBehaviors: {
            //   "/files": {
            //     origin: new S3Origin(bucket.s3Bucket),
            //     allowedMethods: ["GET"],
            //     edgeLambdas: [{
            //       eventType: LambdaEdgeEventType.VIEWER_REQUEST,
            //       functionVersion: viewerRequest.currentVersion,
            //     }],
            //   },
            // },
          },
        });
    f
    • 2
    • 7
  • d

    Daniel da Rocha

    03/01/2022, 5:47 PM
    Maybe someone has a light for me? 💡 Based of https://github.com/serverless-stack/social-cards , I am trying something similar but with updated SST and Typescript; using same versions of Puppeteer, I keep getting the same error another user was getting:
    Copy code
    cannot find module puppeteer/lib/Browser
    Not sure what else to try. Here is my GH repo if anyone could to take a look? 🙏 https://github.com/danrocha/amazon-book-page
    f
    j
    • 3
    • 6
  • g

    Garret Harp

    03/01/2022, 6:33 PM
    Anyone know how to set reportBatchItemFailures to true on a version of the cdk that doesnt support it yet? (for sqs consumer)
    f
    • 2
    • 4
  • r

    Ross Gerbasi

    03/01/2022, 10:48 PM
    So curious but how come a vite build is triggered for a
    ViteStaticSite
    when running
    sst start
    and a stack change happens? Anytime I save a stack file it does
    Stacks: Synthesizing changes..
    then ends up rebuilding the site. I would think in local dev mode there isn't much use for a vite build?
    t
    f
    • 3
    • 8
  • m

    Michael James Munar

    03/02/2022, 10:48 AM
    I have a question regarding deployment.
    npx sst start
    ^ when I run this, everything works fine, but on deployment I keep getting this error which I couldn't find how to fix
    Copy code
    Error: There was a problem transpiling the Lambda handler: > node_modules/pg/lib/native/client.js:4:21: error: Could not resolve "pg-native" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
        4 │ var Native = require('pg-native')
          ╵                      ~~~~~~~~~~~
        at Object.bundle (/tmp/seed/source/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:226:23)
        at Object.bundle (/tmp/seed/source/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:19:16)
        at new Function (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Function.ts:362:39)
        at Function.fromDefinition (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Function.ts:514:14)
        at Api.createFunctionIntegration (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:579:23)
        at Api.addRoute (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:466:26)
        at /tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:303:12
        at Array.forEach (<anonymous>)
        at Api.addRoutes (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:302:25)
        at new Api (/tmp/seed/source/node_modules/@serverless-stack/resources/src/Api.ts:272:10)
    There was an error synthesizing your app.
    Anybody knowledgeable on bundling, please enlighten me Edit: the package I added is
    pg-promise
    -> https://github.com/vitaly-t/pg-promise
    r
    f
    j
    • 4
    • 9
  • j

    Jamie Berke

    03/02/2022, 1:36 PM
    I have just upgraded to the latest version
    0.66.3
    and I am getting the following error at runtime
    Copy code
    Cannot use import statement outside a module
    (node:65576) Warning: require() of ES modules is not supported.
    require() of /Users/jamieberke/Documents/GitHub/dentr/backend/node_modules/@serverless-stack/aws-lambda-ric/bin/index.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.
    Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/jamieberke/Documents/GitHub/dentr/backend/node_modules/@serverless-stack/aws-lambda-ric/package.json.
    t
    f
    • 3
    • 10
  • s

    Sulaiman Baig

    03/02/2022, 3:53 PM
    I am trying to create a user but getting an error shown in the image. I am following the notes app tutorial. Can someone guide me on what I am doing wrong?
    • 1
    • 1
  • c

    Chris

    03/02/2022, 6:27 PM
    I posted a longer thread over on discourse regarding this but am cross posting shorter version here in case slack is preferred for help. I have a lambda function that runs fine during local live development but fails when deployed to AWS. I'm using the mailchimp node module which is a client to their web services. It's not an es module but i'm importing it like this:
    Copy code
    import mailchimp from "@mailchimp/mailchimp_marketing";
    When I run the lambda on AWS I get the following error:
    Copy code
    "errorType": "TypeError",
        "errorMessage": "Cannot set property 'setConfig' of undefined",
        "stack": [
            "TypeError: Cannot set property 'setConfig' of undefined",
            "    at /var/task/src/test.js:7:245570",
            "    at /var/task/src/test.js:1:249",
            "    at /var/task/src/test.js:7:249760",
            "    at /var/task/src/test.js:1:249",
            "    at Object.<anonymous> (/var/task/src/test.js:7:249825)",
            "    at Module._compile (internal/modules/cjs/loader.js:1085:14)",
            "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
            "    at Module.load (internal/modules/cjs/loader.js:950:32)",
            "    at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
            "    at Module.require (internal/modules/cjs/loader.js:974:19)"
        ]
    The line that fails is not in my own function code, but the included mailchimp source that's transpiled into the lambda at the top. Other node modules I'm using work fine. Is this an issue with the mailchimp module or some bug in the transpile? Again, it all works fine during live development. I'm running version
    0.66.3
    Thanks for any help!
    r
    k
    • 3
    • 7
  • j

    John

    03/02/2022, 9:25 PM
    so I got my first AWS bill 😄 Only 20euro but it was a surprise as I'm just playing around with an idea on SST. I am using a subaccount of my main account so I don't qualify for the free tier. The thing that cost all the money is Amazon Elastic Compute Cloud NatGateway. I'm going to close the subaccount and work on my main account but is there anyway to reduce the NAT Gateway usage/cost?
    r
    t
    f
    • 4
    • 10
  • n

    Nir Weiner

    03/02/2022, 11:52 PM
    Hi. When I use
    npx sst start
    , and make a change to MyStack.ts - nothing is redeployed. I guess it is not tracking changes in the stack. Any workaround beside restarting sst?
    g
    m
    • 3
    • 6
  • a

    Aman Saran

    03/03/2022, 12:52 AM
    Anyone here have issues with API Gateway consuming the authorization header when using a proxy to send the request?
    f
    j
    • 3
    • 9
1...545556...83Latest