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

    Sam Hulick

    08/17/2021, 3:03 AM
    @thdxr where’s a good place to have some back & forth about esbuild plugin support, now that the 0.12.20 update is out? the plugin I was using in Serverless Framework doesn’t work. the structure is very different
    t
    • 2
    • 49
  • b

    Ben McGraw

    08/17/2021, 3:16 AM
    In regards to https://docs.serverless-stack.com/live-lambda-development
    a
    • 2
    • 2
  • b

    Ben McGraw

    08/17/2021, 3:18 AM
    I put breakpoints in my lambda's .ts and transpiled .js but nothing is stoppin'.
    f
    r
    • 3
    • 17
  • s

    Sam Frampton

    08/17/2021, 10:27 AM
    AWS question using SDK/SST to create S3 Bucket and I'm getting permission denied error. I've added the IAM permissions to serverless yaml file I've granted it
    s3*
    and added the arn and bucket name to environment and resource from my sst created bucket. I'm still getting permission denied 403, can someone explain why this is case?
    f
    • 2
    • 5
  • a

    Aram

    08/17/2021, 11:59 AM
    Hey folks, Anyone used datadog-lambda-js with sst in development mode? It's throwing errors like this
    Copy code
    ERROR Error [TypeError]: (intermediate value)(intermediate value)(intermediate value).toLowerCase is not a function
        at TraceListener.onWrap (/code/messaging/node_modules/datadog-lambda-js/src/trace/listener.ts:117:67)
    datadog-lambda-js
    needs a wrapper around the function's handler and it seems like it's failing because sst is re-wrapping the handler. Is that assumption correct? If so, is there a way to have dd wrapper around sst wrapper? Thanks!
    t
    • 2
    • 11
  • g

    Guy Shechter

    08/17/2021, 1:03 PM
    Hi All, AWS API Gateway has a max payload limit of 10MB for Http APIs, but only 128 kB for Websocket APIs. I’m trying to paginate results from my API, but I need to know the payload limit from within my Lambda function? Is there any way to tell whether it is running in deploy mode (HTTP API) or in debug (WS API) mode ? Thanks! https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table
    t
    r
    o
    • 4
    • 31
  • s

    Sam Hulick

    08/18/2021, 2:59 AM
    man, sometimes
    yarn start
    is agonizingly slow. I’ve been sitting here for almost 10 minutes. I just changed a few Lambdas tied to HTTP API. is there anything I can do to speed this up?
    t
    f
    a
    • 4
    • 15
  • v

    Vishal Vijay

    08/18/2021, 7:35 AM
    Hi all Is there a way to find the minimum required IAM user permission to deploy my SST to AWS? Basically I need to share this list of permissions to our internal devops team for them to create a deployment IAM user which will be used in our CI/CD pipeline.
    a
    s
    • 3
    • 9
  • s

    Sam Hulick

    08/18/2021, 8:46 PM
    is it generally known how much latency is added when running in live debug mode, and having a local front end client make API calls?
    f
    t
    • 3
    • 14
  • s

    Sam Hulick

    08/18/2021, 9:09 PM
    strange. this function worked fine in live debug mode, but not when I deployed it. I get this error:
    "Runtime.ImportModuleError: Error: Cannot find module './dialects/postgres/index.js'"
    f
    • 2
    • 4
  • s

    Sam Hulick

    08/18/2021, 10:23 PM
    should function building take this long? just over 2 minutes to build these functions, and they’re pretty tiny 😕 this is about how slow Serverless Framework was when I was using
    serverless-webpack
    ..then I switched to
    serverless-esbuild
    and it would rip through 70+ functions in less than 15-20 seconds
    f
    • 2
    • 18
  • s

    Sam Hulick

    08/18/2021, 10:31 PM
    is anyone here by any chance using
    middy
    for API request validation? for some reason, invalid API calls (missing required params) are being passed to the underlying Lambda code
    d
    a
    a
    • 4
    • 46
  • s

    Sam Hulick

    08/18/2021, 11:41 PM
    for granting cross-account access to Lambda layers, does anyone know if there’s a more automated way of running
    aws lambda add-layer-version-permission --layer-name <xyz>
    every time I update a layer? (I’m maintaining these in the primary AWS account, as devs shouldn’t have to bother with these. this seems like an easy thing to forget to do
    • 1
    • 1
  • s

    Sam Hulick

    08/19/2021, 12:04 AM
    I’m curious how other people are handling Sentry + source maps with Lambda. right now, in my Sentry config, I have
    release: process.env.SENTRY_RELEASE
    , and each time I deploy,
    SENTRY_RELEASE
    is the git hash of the current commit. this works fine with associating each function w/ the proper release in Sentry, but the downside is that every time I deploy, EVERY function gets an update. I wonder if there’s a better way to do this
    t
    • 2
    • 8
  • s

    Sam Hulick

    08/19/2021, 5:46 AM
    I can’t figure out how to get this working in SST/CDK. it works in the Serverless Framework version of my API
    Copy code
    import { defaultProvider } from '@aws-sdk/credential-provider-node';
    import AWSAppSyncClient, { AUTH_TYPE } from 'aws-appsync';
    import 'isomorphic-fetch';
    
    const appSyncClient = new AWSAppSyncClient({
      url: process.env.GRAPHQL_ENDPOINT_URL,
      region: 'us-east-1',
      auth: {
        type: AUTH_TYPE.AWS_IAM,
        credentials: defaultProvider(),
      },
      disableOffline: true,
    });
    
    let client: AWSAppSyncClient<any>;
    
    export default async function getGraphqlClient() {
      if (client) return client;
    
      client = await appSyncClient.hydrated();
      return client;
    }
    the credentials are no good for some reason, I’m getting a 401 when my API tries to make a GraphQL call 🤔
    a
    • 2
    • 27
  • s

    Sam Hulick

    08/19/2021, 3:53 PM
    can you not do this within
    app.setDefaultFunctionProps()
    ?
    Copy code
    layers: [
          lambda.LayerVersion.fromLayerVersionArn(
            app,
            'KnexLayer',
            process.env.KNEX_LAYER_ARN
          ),
        ],
    I’m getting: `Error: Import at 'KnexLayer' should be created in the scope of a Stack, but no Stack found`why have a
    layers
    array on that method then?
    t
    • 2
    • 22
  • s

    Sam Hulick

    08/19/2021, 4:57 PM
    hey guys, I have a potential problem with Lambda layers & binary executables. I have a version of sharp compiled for Amazon Linux that lives in the layer, and this works fine normally. but when I run in live debug mode, it doesn’t work:
    Copy code
    Something went wrong installing the "sharp" module
    
    Cannot find module '../build/Release/sharp-darwin-x64.node'
    Require stack:
    - /Volumes/SuperData/Sites/reelcrafter/v2-microservices/.build/src/services/media-processor/functions/get-metadata.js
    - /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/cli/scripts/util/bootstrap.js
    my theory is that the Lambda code is running locally on the Darwin architecture, but it’s using the Lambda layer which is Amazon Linux arch. how can I solve this?
    t
    t
    • 3
    • 108
  • s

    Sam Hulick

    08/19/2021, 8:25 PM
    is there a way to reference the stack name, without the stage prefix & everything attached? (which
    stack.stackName
    does)
    t
    • 2
    • 2
  • k

    Kujtim Hoxha

    08/19/2021, 8:27 PM
    Hi there, I am trying to create a Cloudfront distribution for media files (e.x a user uploads to s3 using signed urls) and I want to make that available through
    <http://media.mysite.com/|media.mysite.com/>...
    , I was trying to use the
    StaticSite
    as an example but for some reason the
    DnsValidatedCertificate
    is giving me an error, it is trying to find a lambda function in
    lambda.Code.fromAsset(path.resolve(__dirname, '..', 'lambda-packages', 'dns_validated_certificate_handler', 'lib')),
    looking at the source code and because of that
    sst start
    is giving me an error
    Copy code
    Error: Cannot find asset at /Users/path/to/my/app/.build/lambda-packages/dns_validated_certificate_handler/lib
    f
    r
    • 3
    • 35
  • s

    Sam Hulick

    08/19/2021, 9:43 PM
    I’m running into a weird tsconfig issue (related to what we just talked about w/ restructuring the project, @thdxr) in my
    src/lambda
    folder (which is a workspace/subpackage), I have this tsconfig:
    Copy code
    {
      "extends": "../../tsconfig.json",
      "compilerOptions": {
        "baseUrl": ".",
        "paths": {
          "$core/*": ["../core/*"],
          "$libs/*": ["./libs/*"],
          "$types/*": ["./types/*"]
        },
      }
    }
    this works perfectly fine, so anywhere in lambda/* I can do
    import { blah } from '$libs/whatever'
    . at least, VS Code says it’s fine and it resolves.. but when I do `yarn build`:
    Copy code
    src/lambda/graphql/mutations/update-transcoding-status.ts:2:31 - error TS2307: Cannot find module '$libs/db' or its corresponding type declarations.
    
    2 import { dataApi, knex } from '$libs/db';
    how do I resolve this?
    t
    • 2
    • 19
  • s

    Sam Hulick

    08/19/2021, 10:35 PM
    just found a bug, I think. I have a whole bunch of invalid
    import
    statements (bad paths) and SST let me run
    yarn start
    and got all the way through type-checking, building, and was about to start a debug process and then it bombed. I ran
    yarn test
    after just to see, and it reports no issues.
    t
    f
    • 3
    • 4
  • a

    Anupam Dixit

    08/20/2021, 7:18 AM
    Hi, I am deploying a serverless stack app and need some help with the following issues I am facing: 1. While deploying the app, I am having this s3 bucket issue ->
    StagingBucket cdk-hnb659fds-assets-741386957827-ap-south-1 already exists
    . How to get around with this ? (or why this might be happening?) 2. SST is also creating resources prefixed with
    cdk-*
    for iam roles and bucket names (in addition to the resources prefixed with stage name). Can I rename them somehow in my code ? So I can use prefixes like
    dev-*
    for these resources based on the stage name ? 3. What is the role of aws ssm in serverless stack deployment ? -> I was not giving ssm permissions earlier, as I did not think it is necessary, but getting this error
    user is not authorized to perform: ssm:PutParameter on resource: arn:aws:ssm:ap-south-1:741386957827:parameter/cdk-bootstrap/hnb659fds/version
    . Do I have to give these permissions to the user too then ? Please let me know if any more clarification is needed.
    a
    f
    • 3
    • 6
  • a

    Aram

    08/20/2021, 8:41 AM
    Hi guys, how can I add tags to functions in sst?
    t
    a
    • 3
    • 3
  • s

    Sam Hulick

    08/20/2021, 6:45 PM
    hey @thdxr, remember we talked about updating the Sentry release hash in SSM, rather than updating in the Lambda envs all the time? how would I do that if we can’t use async funcs in the SST code?
    t
    • 2
    • 5
  • s

    Sam Hulick

    08/20/2021, 8:55 PM
    is there any way to tell why a stack was modified? I added one new API function and a route for it, and a whole bunch of policies changed, and I’m not sure why.
    f
    t
    • 3
    • 60
  • a

    Artem Pabacham

    08/21/2021, 10:05 AM
    In order to use the existing S3 bucket, I wrote this code. Is that the right approach?
    const uploadFilesConfig = s3.Bucket.fromBucketName(
    stack,
    "UploadFilesBucketDev",
    process.env.AWS_S3_UPLOAD_FILES_BUCKET_NAME,
    );
    this.uploadFilesBucket = new sst.Bucket(stack, "UploadFilesBucket", {
    s3Bucket: uploadFilesConfig,
    });
    f
    • 2
    • 1
  • s

    Slawomir Stec

    08/21/2021, 3:20 PM
    Hello & thank you for the Serverless Framework (I'm a big fan). I'm running sst in a development mode. Following lambda code outputs a folder structure from my OS. I would expect to see a lambda execution environment folder structure.
    Copy code
    import {APIGatewayProxyEventV2, APIGatewayProxyHandlerV2} from "aws-lambda";
    import * as fs from 'fs'
    
    export const handler: APIGatewayProxyHandlerV2 = async (event: APIGatewayProxyEventV2) => {
    
        fs.readdirSync("/").forEach(file => {
            console.log(file);
        });
    
        return {
            statusCode: 200,
            headers: {"Content-Type": "text/plain"},
            body: `Response: ${JSON.stringify({})}`,
        };
    };
    I come across this when trying to use EFS in the lambda code. Attached code list my OS folder structure.  Any hints?
    t
    r
    f
    • 4
    • 12
  • a

    Artem Pabacham

    08/22/2021, 3:38 PM
    Does it make sense to add file sizes, the same as we have in create-react-app? https://monosnap.com/file/7gXAIqKdDuxmg8r0f2fHzRP3JQF2gJ
    t
    • 2
    • 1
  • s

    Sam Hulick

    08/22/2021, 7:30 PM
    just a heads-up, though this is probably more of a bug with CloudFormation: you can’t change route parameters, e.g.
    GET /things/{id}
    to
    GET /things/{thingId}
    . you’ll get an error saying the route already exists.. so it seems you have to fully remove that route, deploy, add it back in, and deploy again
    f
    t
    a
    • 4
    • 7
  • a

    Andrew Myers

    08/23/2021, 6:45 AM
    For python functions, how do I ensure dependencies are deployed? I have boto3 inside a Pipfile and requirements.txt, but I’m seeing
    ModuleNotFoundError: No module named 'boto3'
    when I call the endpoint provided by
    npx sst start
    t
    • 2
    • 2
1...131415...83Latest