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

    Jacob Hayes

    08/27/2021, 1:43 PM
    Has anyone ran into issues with
    serverless-bundle
    and
    aws-appsync
    using a different version of graphql in their dependencies and causing the following error?:
    Copy code
    "errorMessage": "Cannot use n \"__Schema\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\n<https://yarnpkg.com/en/docs/selective-version-resolutions>\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."
    This only started happening when I added
    serverless-bundle
    to leverage yarn/lerna workspaces. All my services work correctly outside of the couple that are using the
    aws-appsync
    libs which appear to be using a really old graphql version (0.13.0) whereas
    serverless-bundle
    is using version 15.5.1
    f
    j
    • 3
    • 7
  • j

    Jereme Monteau

    08/27/2021, 3:08 PM
    Is there a design pattern in serverless/sst for throttling calls to a third-party API? For example we have an API we use that has a 2 request per minute limit. Is there an established pattern for processing jobs within a serverless framework at maximum rate?
    t
    a
    • 3
    • 9
  • s

    Sam Hulick

    08/27/2021, 9:01 PM
    is there any way to (using SST/CDK) map one custom API Gateway domain to multiple APIs in different stacks?
    t
    a
    +2
    • 5
    • 41
  • d

    Dennis Dang

    08/27/2021, 10:23 PM
    Anyone familiar with creating cloudwatch alarms or datadog monitors that monitor across an entire apigateway for 5xx errors? I can see options to create a metric/alarm per lambda in cloudwatch, but unable to see an option to create an "umbrella"/catchall alarm.
    f
    d
    • 3
    • 10
  • s

    Sam Hulick

    08/27/2021, 11:24 PM
    here’s a long shot: is there any way to allow an AWS account to create an API Gateway custom domain using another AWS account’s hosted zone?
    a
    f
    • 3
    • 5
  • a

    Abdul Taleb

    08/28/2021, 4:24 AM
    Anyone try manually deploying a next.js ssr app using lambda & s3 (similar to serverless-nextjs)?
    f
    • 2
    • 3
  • d

    Daniel da Rocha

    08/29/2021, 3:51 PM
    I have the impression this should be simple: I want to create a Bucket that my SES rule will use to store emails. However, I need to apply a Bucket policy to allow SES to use it. If I create this bucket through the SES dashboard, it attached these policies:
    Copy code
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AllowSESPuts-1629654011154",
          "Effect": "Allow",
          "Principal": {
            "Service": "<http://ses.amazonaws.com|ses.amazonaws.com>"
          },
          "Action": "s3:PutObject",
          "Resource": "arn:aws:s3:::mailtosheet-emails/*",
          "Condition": {
            "StringEquals": {
              "aws:Referer": "326317869239"
            }
          }
        }
      ]
    }
    How could I do the same if I create the bucket using SST? I went as far as this:
    Copy code
    this.mailBucket = new sst.Bucket(this, "mts-emails");
    
    const SESPolicy = new iam.PolicyStatement({
          actions: ["s3:PutObject"],
          effect: iam.Effect.ALLOW,
          resources: [this.mailBucket.bucketArn],
          principals: [new iam.ServicePrincipal("<http://ses.amazonaws.com|ses.amazonaws.com>")],
          conditions: {
            StringEquals: {
              "aws:Referer": "326317869239",
            },
          },
    });
    But then, I got lost on how to apply this policy to the bucket… reading into
    attachPermissions
    did not make it very clear where to insert `SESPolicy`…. Anyone knows? 🙏
    f
    • 2
    • 1
  • s

    Sam Hulick

    08/29/2021, 11:53 PM
    is there any way within the SST code to be able to tell which action is being performed? e.g.
    remove
    vs
    deploy
    vs
    diff
    t
    • 2
    • 10
  • a

    Aso Sun

    08/30/2021, 10:43 AM
    Hi, I am a newbie. How can I create multiple dynamoDB tables with SST, and how can I pass the name of these tables?
    a
    • 2
    • 8
  • p

    Pavan Kumar

    08/30/2021, 1:38 PM
    Does
    ApolloApi
    support subscription?
    f
    • 2
    • 2
  • a

    Abdul Taleb

    08/30/2021, 3:42 PM
    If my stack includes several websites and services and I only want to deploy the services where the code has changed, how do I do that without deploying the whole stack? (in CI/CD)
    a
    • 2
    • 14
  • a

    Abdul Taleb

    08/30/2021, 4:09 PM
    Another question re: debugging locally. If I'm using my personal stack
    $(whomai)
    , and I'm debugging something in
    dev
    environment, what's the best way to use
    dev
    cognito pool rather than my personal cognito pool?
    t
    • 2
    • 10
  • s

    Sam Hulick

    08/30/2021, 7:06 PM
    has anyone else had trouble with linting not working in SST projects that are TS-based? it seems to totally ignore my
    .eslintrc.json
    t
    a
    • 3
    • 41
  • d

    Dillon Peterson

    08/30/2021, 8:31 PM
    Hi all! I have a JS SST App with an API that I need to add routes to -- these routes are defined in a Python SST App. What is the best way to go about this? They are 2 separate repos, 2 separate apps.
    t
    • 2
    • 2
  • j

    Janessa

    08/31/2021, 12:32 AM
    Hey there! I am trying to add a layer to a lambda via an ARN. I haven’t yet been successful and wanted to see if anyone could provide more clarity about what I should be adding as the
    externalModule
    to bundle (example below)? Here are the docs I’m referencing: https://docs.serverless-stack.com/working-locally#using-lambda-layers
    Copy code
    new sst.Function(this, "test", {
          handler: "src/app/testLambda.lambdaHandler",
          bundle: {
            nodeModules: ["winston"],
            externalModules: ["SentryNodeServerlessSDK"] // also tried "@sentry/serverless"
          },
          layers: [
            lambda.LayerVersion.fromLayerVersionArn(this, "SentryLayer", "arn:aws:lambda:us-west-2:943013980633:layer:SentryNodeServerlessSDK:29")
          ]
        })
    Also for more context, I’m trying to add a sentry layer. The docs I’m using are here: https://docs.sentry.io/platforms/node/guides/aws-lambda/layer/ Thanks in advance 😄
    f
    • 2
    • 6
  • g

    Guy Shechter

    08/31/2021, 3:47 AM
    Can anyone point me to an SST example of a React SPA where the only authentication is done via federation to Google e.g. GSuite login?
    f
    • 2
    • 9
  • s

    Sam Hulick

    08/31/2021, 4:09 AM
    anyone know why this happens? it’s ok now, but when we’re in production, this will be difficult to resolve as I can’t just remove stacks
    Copy code
    ❌  dev-microservices-media-processor failed: Export dev-microservices-media-processor:ExportsOutputRefMakeSnippetFuncA30B25837ED330C0 cannot be deleted as it is in use by dev-microservices-api-media
    basically, the APIMedia stack used to depend on a function defined in the MediaProcessor stack. but it doesn’t anymore.. I removed references to
    MakeSnippetFunc
    in the APIMedia stack. so I think it’s trying to clear out the export, but it can’t
    f
    • 2
    • 8
  • a

    Anupam Dixit

    08/31/2021, 7:50 AM
    How can I deploy a private APIGateway ? By default, the app is deployed on a public gateway url.
    f
    • 2
    • 6
  • k

    Kujtim Hoxha

    08/31/2021, 11:53 AM
    Hi, If I wanted to setup multiple services under the same repo e.x
    Copy code
    ---> serviceA
    ------> lib
    --------->index.ts
    ------> src
    -------->handlers
    ------> sst.json
    
    ---> servoiceB
    ------> lib
    --------->index.ts
    ------> src
    -------->handlers
    ------> sst.json
    
    ---> common
    ------> lib
    ---------->api.stack.ts
    ----------> index.ts
    ------> sst.json
    Is there a way that all the services can share the same API gateway and for e.x the same cognito authorizer? In addition to that would Seed recognise them as separate services and deploy only the once that changed? If something in common changes (a common resource) that would in turn affect serviceA would that trigger the build for A?
    t
    • 2
    • 10
  • s

    Sam Hulick

    08/31/2021, 7:47 PM
    how do we set up CORS on a per-route basis? I’m running into an issue where one of my routes is called from the front end
    withCredentials: true
    , and the
    OPTIONS
    request is failing because the response can’t be
    access-control-allow-origin: *
    when
    withCredentials === true
    f
    • 2
    • 13
  • s

    Sam Hulick

    08/31/2021, 9:15 PM
    is there anything special I have to do to get a CloudFront CNAME working for an S3 bucket? if I edit the distribution, I see under CNAMEs, the correct domain. but there’s no entry for it in Route 53
    a
    • 2
    • 10
  • s

    Sam Hulick

    08/31/2021, 9:23 PM
    request: can we get an update to the latest CDK version in the near future? it’s impossible to set this to the recommended setting. apparently they didn’t add
    SecurityPolicyProtocol.TLS_V1_2_2021
    until after 1.114.0
    f
    • 2
    • 5
  • a

    Adrián Mouly

    08/31/2021, 10:00 PM
    Is anybody using CloudFront Functions? I want to display some content on my React app based on user-country… I know CF has some headers returned with country-code, but I would like to have that embedded into the HTML/JS to make decisions based on that. Anybody used this approach? Or maybe my lambda ideally can have that info.
    a
    • 2
    • 10
  • a

    Adrián Mouly

    09/01/2021, 8:05 AM
    Does anybody used API GW v2 + CFront Viewer variables? I want to know from CFront the value
    Cloudfront-Viewer-Country
    . Apparently this is possible to do using Edge from GW v1, but not using GW v2 with Regional? https://stackoverflow.com/questions/64318725/geolocation-service-with-aws-api-gateway-and-lambda
    f
    • 2
    • 2
  • a

    Aram

    09/01/2021, 8:21 AM
    Hey guys, A quick question. How can I reference the live version of a function in sns topic subscribers? My code looks like this
    Copy code
    // WebhookEventsProcessor
    const webhookEventsProcessor = new Function(this, 'WebhookEventsProcessor', {
      handler: 'src/webhookEventsProcessor.handler',
      functionName: `${scope.stage}-webhook-events-processor`,
      memorySize: 256,
      timeout: 30,
      environment: {
        ...globalEnvironment,
        SEND_WEBHOOK_EVENTS_QUEUE: sendWebhookEventsQueue.sqsQueue.queueUrl,
      },
      permissions: ['sns', 'sqs'],
      currentVersionOptions: {
        provisionedConcurrentExecutions: 1,
      },
      vpc: appVpc,
      vpcSubnets: {
        subnets: appVpc.privateSubnets,
      },
    });
    const webhookEventsProcessorLive = webhookEventsProcessor.currentVersion;
    const messagingEventsTopic = new Topic(this, 'MessagingEvents', {
      subscribers: [
        {
          function: webhookEventsProcessorLive,
        },
      ],
    });
    and the error I'm getting when trying to build this is
    Copy code
    {"awsRequestId":"NOT SET YET","level":"error","message":"(node:24544) UnhandledPromiseRejectionWarning: Error: Invalid function definition for the \"Subscriber_0\" Fun
    ction\n    at Function.fromDefinition (/code/messaging/node_modules/@serverless-stack/resources/src/Function.ts:433:11)\n    at Topic.addFunctionSubscriber (/code/mess
    aging/node_modules/@serverless-stack/resources/src/Topic.ts:203:19)\n    at Topic.addSubscriber (/code/messaging/node_modules/@serverless-stack/resources/src/Topic.ts:
    158:12)\n    at /code/messaging/node_modules/@serverless-stack/resources/src/Topic.ts:117:46\n    at Array.forEach (<anonymous>)\n    at Topic.addSubscribers (/code/me
    ssaging/node_modules/@serverless-stack/resources/src/Topic.ts:117:17)\n    at new Topic (/code/messaging/node_modules/@serverless-stack/resources/src/Topic.ts:72:10)\n
        at new MindfulMessagingStack (/code/messaging/services/sst/lib/MindfulMessagingStack.ts:146:34)\n    at Object.main (/code/messaging/services/sst/lib/index.ts:27:2
    5)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n(Use `node --trace-warnings ...` to show where the warning was created) "}
    {"awsRequestId":"NOT SET YET","level":"error","message":"(node:24544) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by th
    rowing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled pro
    mise rejection, use the CLI flag `--unhandled-rejections=strict` (see <https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode>). (rejection id: 1) "}
    {"awsRequestId":"NOT SET YET","level":"error","message":"(node:24544) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise
     rejections that are not handled will terminate the Node.js process with a non-zero exit code. "}
    {"awsRequestId":"NOT SET YET","level":"info","message":"\u001b[90mLinting Lambda function source\u001b[39m "}
    f
    • 2
    • 7
  • a

    Aso Sun

    09/01/2021, 11:51 AM
    Q1: I’ve already created a cognito identity pool and user pool and iam policy via console followed an earlier version guide. Do I still need to pass APIs to auth stack? If yes, how?
    f
    • 2
    • 10
  • a

    Aso Sun

    09/01/2021, 11:58 AM
    Q2: In the previous versions of guide, we get the user identity id by
    event.requestContext.identity.cognitoIdentityId
    , why does it become
    event.requestContext.authorizer.iam.cognitoIdentity.identityId
    in the latest guide?
    f
    • 2
    • 2
  • g

    George Evans

    09/01/2021, 3:51 PM
    Hi, I am trying to set up multiple stacks with Serverless stack. One for auth, one for the api as I want to keep them separate for other services using the auth service. I need to pass the userpool id as an environement variable to the lambdas in the api stack. I have been attempting to use cloudformation outputs and inputs to do this but it always attempts to build the API stack first rather then the auth stack which then causes an error. Is there a way to define the order the stacks build in? Or is there a better way to pass parameters between stacks (also attempted SSM but run into the same issue)?
    f
    m
    • 3
    • 28
  • g

    Gevorg A. Galstyan

    09/01/2021, 3:55 PM
    Q1: Is there a way to run SST against localstack?
    t
    a
    a
    • 4
    • 18
  • g

    Gevorg A. Galstyan

    09/01/2021, 3:56 PM
    Q2: How can I get containerized functions work with SST?
    t
    a
    • 3
    • 10
1...151617...83Latest