https://serverless-stack.com/ logo
Join Slack
Powered by
# help
  • b

    Bob Wall

    06/20/2022, 7:01 PM
    Is there a way to not use the iam name and folder in all the resources. for exampel I have bobwall-oasis-OasisStack-photoResizeHandler-GUID as the name, but i really want it to just be OasisStack-photoResizeHandler-GUID. or is that just the preferred way?
    a
    • 2
    • 3
  • j

    Justin Robinson

    06/20/2022, 7:51 PM
    I'm working with 1.1.2 how does this make sense?? (these lines where added in the same PR #1594) The comment example, shows setting a cors object, while the type is boolean, so actually doing what the example suggests is possible is impossible. Setting cors=true doesn't seem to allowHeaders: ["*"] is it supposed to?
    f
    • 2
    • 4
  • r

    Ross Gerbasi

    06/20/2022, 9:27 PM
    Is there a way to allow each dev on a team to change AWS region for a project that wouldn't be committed? maybe like a
    sst.local.json
    haha... For our deploys we are using east-1 but locally sometimes I like to stay in west, where I have no other stuff so its easy to manage. I only know of
    sst.json
    and then
    package.json
    I could add region to my scripts, but both of those are shared files. Any other ways override?
    m
    t
    f
    • 4
    • 47
  • d

    Daniel Gato

    06/21/2022, 5:52 AM
    Hi, We have moved our frontend and other products to AWS with SST. Lastly, we have our Ruby on Rails api running on Heroku. It uses Sidekiq and PG. What would be the equivalent to run this one with SST? At the moment we use a docker container and use Github Actions for CI/CD. We are trying to have the maximum of serverless here, and I’m not sure what product from AWS that is compatible with SST would allow us to run RoR workers and web processes.
    g
    a
    • 3
    • 9
  • s

    sumitavo biswas

    06/21/2022, 7:22 AM
    Hello i use
  • s

    sumitavo biswas

    06/21/2022, 7:23 AM
    hello i use seed.run actively to deploy my serverless stacks to AWS. it works fine for lat 4 month...Suddenly starting from today when i push anything in github , the build is failing with the following error
  • s

    sumitavo biswas

    06/21/2022, 7:23 AM
    Copy code
    $ cd /tmp/seed/source
    INFO: before_build hook not found. You can define it in your build spec.
    INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
    $ cd /tmp/seed/source/serverless-cloudprotect365-complete
    Copy code
    $ npx sst build --stage dev --verbose
    29.71 s
    Copy code
    ====================
    🚀 Deploy
    ====================
    
    $ cd /tmp/seed/source
    INFO: before_deploy hook not found. You can define it in your build spec.
    INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
    ERROR: Failed to run: npm install -g @seed-run/aws-cdk@v2.24.0-seed.1
    f
    • 2
    • 1
  • s

    Sakar

    06/21/2022, 8:01 AM
    Hi, I am using an existing DynamoDB, how to enable stream on it? my code:
    const table = new Table(stack, "Table", {
    cdk: {
    table: dynamodb.Table.fromTableArn(
    stack,
    "ec.subscriptions",
    "arn:aws:dynamodb:ap-south-1:146331168322:table/ec.subscriptions"
    ),
    stream: true,
    consumers: {
    consumer1: "functions/lambda.handler",
    },
    },
    });
    I have not set any stream or trigger in my DynamoDB. I want to enable stream and trigger from SST.
    a
    f
    • 3
    • 11
  • k

    Karolis Stulgys

    06/21/2022, 12:26 PM
    👋 I follow: https://serverless-stack.com/examples/how-to-create-a-nextjs-app-with-serverless.html after adding
    @serverless-stack/static-site-env
    to frontend and
    @sls-next/lambda-at-edge
    to root I get this nonsens error when I run yarn start (backend) and yarn dev (frontend). I have latest deps, node v16.15.1, using yarn
    Copy code
    TypeError: Cannot read properties of null (reading 'useContext')
    Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
    1. You might have mismatching versions of React and the renderer (such as React DOM)
    2. You might be breaking the Rules of Hooks
    3. You might have more than one copy of React in the same app
    See <https://reactjs.org/link/invalid-hook-call> for tips about how to debug and fix this problem.
    TypeError: Cannot read properties of null (reading 'useContext')
    a
    f
    • 3
    • 9
  • d

    David Garcia

    06/21/2022, 6:58 PM
    Hey y'all, is anyone aware of whether or not granting read/write from an s3 bucket to another s3 bucket grants replications permissions?
    a
    f
    • 3
    • 5
  • t

    Tamás Krasser

    06/21/2022, 9:54 PM
    I have the same problem: https://stackoverflow.com/questions/71449349/making-sqs-message-visible-again-using-partial-batch-response I have a queue and I return
    batchItemFailures
    to mark failed messages. I assumed SQS will retry them immediately but it doesn’t, it shows them “in flight” until their visibility times out. What am I missing?
    f
    f
    • 3
    • 5
  • s

    Sakar

    06/22/2022, 4:39 AM
    Hi, I have manually uploaded my static site to S3 bucket and configured Route53 records. But I have not set SSL certificate or Cloud Formation. Now I want to deploy my static site using SST. What will happen? Does SST overwrite my S3 bucket and Route53 records or I have to delete my old S3 bucket and Route53 records to use SST to deploy my static website.
    d
    f
    • 3
    • 3
  • s

    Sakar

    06/22/2022, 4:52 AM
    Hi, please let me know where to put DynamoDB stream FilterCriteria in SST. eg:
    FilterCriteria: {
    filters: [
    {
    pattern:
    '{"eventName":["INSERT"],"dynamodb":{"pk":{"Type":{"S":["newsletter"]}}}}',
    },
    ],
    },
    f
    a
    • 3
    • 5
  • t

    Tamás Krasser

    06/22/2022, 3:45 PM
    I have a use case where I want to have a queue of jobs and then one-by-one invoke a lambda which should have a very low (1-2) concurrency. If a job fails it should be retried ~5 times before DLQ. After some research it seems a simple SQS queue is not a good fit for this (messages will be rejected because the lambda can't be invoked so they'll reach their max retries quickly). Anyone can advice a good pattern to solve this?
    a
    d
    • 3
    • 19
  • d

    David Garcia

    06/22/2022, 6:07 PM
    Hey there, if I make a stack which contains a bucket instantiated as
    Bucket.fromBucketName
    /
    Bucket.fromBucketArn
    will that create a new bucket in my account or will it just create the bucket construct in memory during synth for what i'm doing in the stack?
    t
    • 2
    • 2
  • r

    Rana

    06/22/2022, 10:37 PM
    Hi, I'm trying to create a new project by following this example and running
    npm init sst typescript-starter rest-api-ts
    and I get the following error:
    Template not found at presets/typescript-starter
    . How can I resolve this?
    f
    u
    a
    • 4
    • 8
  • l

    Lutfi Fadlan

    06/23/2022, 2:09 AM
    hello I deployed SST successfully but when I open the console it keeps loading forever saying
    Syncing metadata
    . Appreciate if anyone can help on this, thank you!
    a
    r
    • 3
    • 6
  • k

    Karolis Stulgys

    06/23/2022, 8:24 AM
    👋 I want to upload image to my s3 bucket which should be publicly accessible. Currently when I stick image url in the browser i get
    AccessDenied
    My sst bucket:
    Copy code
    const bucket = new Bucket(stack, 'uploads', {
    		cors: [
    			{
    				maxAge: '1 day',
    				allowedOrigins: ['*'],
    				allowedHeaders: ['*'],
    				allowedMethods: ['GET', 'PUT', 'POST', 'DELETE', 'HEAD'],
    			},
    		],
    	});
    My lambda:
    Copy code
    const s3 = new AWS.S3({
    	accessKeyId: process.env.AWS_S3_ACCESS_KEY_ID,
    	secretAccessKey: process.env.AWS_S3_SECRET_ACCESS_KEY
    });
    
    async function uploadImage(blob) {
    	const uploadedImage = await s3
    		.upload({
    			Bucket: process.env.AWS_S3_BUCKET_NAME,
    			Key: `${new Date().getTime()}.jpeg`,
    			Body: blob,
    		})
    		.promise();
    
    	return uploadedImage.Location;
    }
    r
    • 2
    • 4
  • s

    sforman

    06/23/2022, 9:39 AM
    Probably just me being stupid, but I'm unable to get the bucketName in my api endpoint handlers as an environment variable
    Copy code
    const bucket = new Bucket(stack, 'translation', {
        removalPolicy: stack.stage === 'dev' ? RemovalPolicy.DESTROY : RemovalPolicy.RETAIN
      });
    
      const api = new Api(stack, 'api', {
        routes: {
          'GET /healthcheck': 'functions/lambda.healthcheck',
          'POST /notification': 'functions/lambda.notification'
        },
        // I WOULD IMAGINE THE SAME enviroment property could go here
        // BUT IT DOESN'T ALLOW IT (doesn't exist) and the two endpoints using
        // process.env.TRANSLATION_BUCKET_NAME returns undefined.
      });
    
      const translations = new Function(stack, 'download-translations', {
        handler: 'functions/translations.download',
        environment: {
          TRANSLATION_BUCKET_NAME: bucket.bucketName // THIS SECTION WORKS FOR THIS FUNCTION, but doesn't work on the API enpoints
        }
      });
    Can someone spot my mistake?
    • 1
    • 1
  • c

    colin

    06/23/2022, 2:23 PM
    Hey guys, does anyone know why
    console.log
    statements are not logging nested objects? See:
    [Object]
    below. Is this a cloudwatch thing? Or an SST thing? This statement was pulled from cloudwatch but it is the same locally.
    Copy code
    {
      level: 'INFO',
      message: 'Request received',
      timestamp: '2022-06-23T14:00:35.483Z',
      additional: {
        raw_request: {
          version: '2.0',
          routeKey: 'POST /',
          rawPath: '/',
          rawQueryString: '',
          headers: [Object],
          requestContext: [Object] 
        }
      }
    }
    d
    t
    • 3
    • 4
  • r

    Robert

    06/23/2022, 2:54 PM
    Morning guys! I'm using a new library
    DigestFetch
    and it requires
    node-fetch
    When I do a build, ESBuild gives me the error
    Copy code
    ERROR:   You can mark the path "node-fetch" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
    I can mark it as
    externalModules
    in the bundle to fix the build error, but then I have a runtime error that the library is not present 😕 Back in the days, when using serverless, I could do something like this. Anyone have any idea how I can do something equivalent when creating my stack?
    Copy code
    bundle:
        packager: npm
        forceInclude:
          - node-fetch
        externals:
          - node-fetch
    t
    • 2
    • 15
  • m

    Michael Bannon

    06/23/2022, 3:51 PM
    Hi guys, currently trying to use my application but when I try to create a note I'm getting this error
    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <https://vxabw2e10i.execute-api.us-east-1.amazonaws.com/listing>. (Reason: CORS header 'Access-Control-Allow-Origin' missing). Status code: 404.
    I have it enabled in my handler so not sure what the issue is
    r
    d
    • 3
    • 4
  • v

    Vegard Bjørsvik

    06/23/2022, 4:33 PM
    anyone have a clue why my lambda function would fail on this error message
    (init_lib(...) , __toCommonJS(...)) is not a function
    ?
    • 1
    • 2
  • f

    Frank

    06/23/2022, 6:05 PM
    Hey @Vlad Dexamir can u try defining the authorizers inline?
    v
    f
    • 3
    • 10
  • d

    Dan Van Brunt

    06/23/2022, 7:26 PM
    Any chance it was fixed yet the ability to use a handler in a
    sst.Function
    for liveEditing that is located inside node_modules folder? Right now I have it working but since its not watching files in the nodemodules folder… I need to restart
    sst start
    each time. 😞
    t
    d
    • 3
    • 10
  • v

    Viswa

    06/23/2022, 9:11 PM
    @Frank, @thdxr: I am looking for a way to add retryPolicy to a cron job created using sst.Cron. Can you please point me to an implementation that basically sets retryPolicy on sst.Cron ?
    t
    • 2
    • 2
  • w

    Wyatt Goettsch

    06/24/2022, 12:11 AM
    What's the maximum version of node that sst supports?
    m
    • 2
    • 2
  • w

    Wyatt Goettsch

    06/24/2022, 12:25 AM
    I'm on 16.15.1 (on macos) and still getting this on
    npm start
    Copy code
    import { Api, Table } from "@serverless-stack/resources";
             ^^^
    SyntaxError: Named export 'Api' not found. The requested module '@serverless-stack/resources' is a CommonJS module, which may not support all module.exports as named exports.
    CommonJS modules can always be imported via the default export, for example using:
    
    import pkg from '@serverless-stack/resources';
    const { Api, Table } = pkg;
    
        at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
        at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
        at async Promise.all (index 0)
        at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
        at async
    m
    • 2
    • 11
  • b

    Brandon

    06/24/2022, 8:42 AM
    Hi, everyone. Would someone be able to help with an Auth issue. I have an Auth construct as follows:
    Copy code
    // Auth
    const auth = new Auth(stack, "Auth", {
      cdk: {
        userPool: UserPool.fromUserPoolId(stack, "IUserPool", active_userpool.id),
        userPoolClient: UserPoolClient.fromUserPoolClientId(stack, "IUserPoolClient", active_userpool.clientId)
      }
    });
    The authorizers as follows:
    Copy code
    authorizers: {
      jwt: {
        type: "user_pool",
        userPool: {
          id: auth.userPoolId,
          clientIds: [auth.userPoolClientId]
        },
      },
    }
    I am using the jwt authorizer. The issue is, that this stack exists in a different AWS account than the UserPool. Would anyone know what the implementation is for authorizing with an existing UserPool in a different AWS account?
  • r

    Reece Temple

    06/24/2022, 9:49 AM
    Hi All, Learning SST and i am running into an issue on my install. Im following the start guide here https://docs.serverless-stack.com/, but once I get to npm start it commences then lands on the below errors? [25%] fail: No bucket named 'cdk-hnb659fds-assets-749933395139-ap-southeast-2'. Is account 749933395139 bootstrapped? [50%] fail: No bucket named 'cdk-hnb659fds-assets-749933395139-ap-southeast-2'. Is account 749933395139 bootstrapped? [75%] fail: No bucket named 'cdk-hnb659fds-assets-749933395139-ap-southeast-2'. Is account 749933395139 bootstrapped? [100%] fail: No bucket named 'cdk-hnb659fds-assets-749933395139-ap-southeast-2'. Is account 749933395139 bootstrapped? I havent done anything outside the instructions provided on the site. Any assistance would be fab and help my learning of SST. Thank you! @Frank
    t
    • 2
    • 1