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

    Mike McCall

    11/26/2021, 6:43 PM
    npx sst update
    is only updating the
    @serverless-stack/resources
    version.
    j
    t
    • 3
    • 3
  • o

    O'Dell Sallis

    11/26/2021, 9:42 PM
    Been trying to deploy a nextjs project and having trouble getting auth0 working. Currently using the nextjs-auth0 module with the default [...auth].js file in the /pages/api/auth/ directory. Is there a specific way to configure auth0 when using nextjs?
    t
    f
    • 3
    • 2
  • a

    Artem Kalantai

    11/28/2021, 5:01 PM
    can someone help me what the issue here?
    s
    • 2
    • 10
  • l

    Lincoln Waddell

    11/28/2021, 10:15 PM
    Hello good people! I have a question regarding sharing code between services in a typescript SST app. I have the following structure, where each service is its own SST app.
    Copy code
    libs/
       shared-component.ts
    services/
       service1/
          src/
          stacks/
          package.json
          sst.json
          tsconfig.json
       services2/
          etc.
    Whenever I reference
    shared-component.ts
    inside any of the services I get the following error even though my service has the eslintConfig property present in package.json:
    Copy code
    No eslint config found. There was a change starting in SST v0.48.0 with the eslint integration for better editor support. Please add the following to your package.json:
    
    "eslintConfig": {
      "extends": ["serverless-stack"]
    }
    Any suggestions to allow for typescript files shared between services? Apologies in advance if this is a totally ignorant question. This is my first adventure in typescript. Thank you!
    t
    s
    • 3
    • 40
  • f

    Franco Gotusso

    11/29/2021, 4:13 PM
    Hello folks! I have some configuration issues while using multiple projects and I was wondering if you could help. Say I have a project with the following structure
    Copy code
    root
    ├── package-a/
    │   ├── package.json
    │   ├── tsconfig.json
    │
    ├── package-b/
        ├── package.json
        ├── tsconfig.json
    And package-a references package-b in the following way package-a/package.json
    Copy code
    {
      "dependencies": {
        "@company/package-b": 1.0.0,
      }
    }
    package-a/tsconfig.json
    Copy code
    {
      "compilerOptions": {
        "baseUrl": ".",
        "paths": {
          "@company/package-a/*": [
            "src/*"
          ],
          "@company/package-b/*": [
            "../package-b/src/*"
          ]
        }
      }
    }
    We're doing this to avoid repackaging and reinstalling package-b every time while developing, but we now noticed that while running
    sst start
    ,
    package-b
    gets added automatically to
    externalModules
    and hence not bundled when in reality we want it to be bundled. Any suggestions on how to work around this or make it better? Thanks!
    t
    • 2
    • 13
  • c

    Colin Cheung

    11/29/2021, 4:31 PM
    Can anyone tell me if I can tell
    sst deploy
    to use the output of a previous`sst build` ? It doesn't seem like running
    sst build
    before
    sst deploy
    makes it any quicker.
    t
    a
    • 3
    • 7
  • v

    Victor Rodriguez

    11/29/2021, 9:08 PM
    Hi everybody. I ran into a problem on
    v0.53.2
    . It's a typescript project. Every time I try running
    sst build
    I get
    Error: ENAMETOOLONG: name too long, copyfile. /Users/vrodriguez/Projects/***/***/***/.build/cdk.out/asset.***
    . Anyone seen anything similar before?
    a
    ö
    • 3
    • 7
  • t

    Tim V

    11/29/2021, 10:47 PM
    Heya everyone! This might be more of a question about CDK than Serverless Stack... I'm trying to write a lambda@edge function to listen to viewer request events and run a cognito validator and index.html uri handler. I'm using @aws-cdk/aws-lambda-nodejs because it appears to be the only thing that will accept build parameters that include string replacements. Before hitting the NodeJs build step, I've created a Cognito User Pool and User Pool Client. I'd like to be able to use the IDs of those two in the lambda code. I'm trying to use the new NodeJsFunction params to "define" the userPoolId and clientId... but I just end up with unresolved tokens. Does anyone have insight on how to pull this off? Maybe I need to create two stacks and depend the one on the other? Anywho... thanks for any advice!
    v
    • 2
    • 11
  • s

    Sahan Amadoruge

    11/30/2021, 12:34 PM
    Hey, When we are creating a s3 bucket using Bucket construct, do we need to give putObject permissions to it? 🙄 I need to upload files to the bucket using a signed url. But when i try to upload files i'm getting
    <Code>SignatureDoesNotMatch</Code>
    r
    • 2
    • 1
  • v

    Victor Rodriguez

    11/30/2021, 5:54 PM
    Another issue I ran into: When specifying cloudformation files via
    CfnInclude
    ,
    path.join(__dirname, "../../path/to/file")
    works When using sst constructs, it respects the baseUrl in
    tsconfig.json
    , in my case,
    ./
    which is
    src
    , so
    src/path/to/file
    works For
    experimental.EdgeFunction
    ,
    Code.fromAsset
    , seems like it should work the same as
    CfnInclude
    , but I always get:
    Copy code
    Error: ENOENT: no such file or directory, copyfile '/Users/***/Projects/***/***/node_modules/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.js' -> '/Users/***/Projects/***/***/lambdas/.build/lib/edge-function/__entrypoint__.js'
    t
    • 2
    • 30
  • s

    Sam Hulick

    11/30/2021, 6:27 PM
    has anyone here used SST to create & attach an EFS to their Lambda funcs? how straightforward is it?
    • 1
    • 1
  • d

    Dan Van Brunt

    11/30/2021, 7:36 PM
    [Help w SST StaticSite] We have a lambda@Edge router that processes an
    _redirects
    file in the root of the StaticSite Bucket. The issue right now is that StaticSite puts the file deploys into bucket keys/directories like
    deploy-4f8996501e982c7d7a6bdcd3c2396bc5
    so how can we let the edge function know which is the current? (without having to rebuild our lambda functions)
    t
    • 2
    • 22
  • m

    mkarsene

    12/01/2021, 1:41 AM
    hi everyone, I am trying to use a responsive email framework, mjml, in my lambda function together with vue ssr. However, it only seems to work in development mode but not when deployed. I have narrowed it down to the mjml package. Spent days on this and can't to resolve it. Any ideas?
    Copy code
    import mjml2html from "mjml";
    import { createSSRApp } from "vue";
    import { renderToString } from "@vue/server-renderer";
    import { newRequestTemplate } from "./templates/new-request-template"; // This is just an mjml template
    export async function handler(event) {
      const email_data = JSON.parse(event.body); // input data
      try {
        const app = createSSRApp({
          data() {
            return email_data;
          },
          template: newRequestTemplate,
        });
    
        // Tell Vue to recognize mjml components. See: <https://v3.vuejs.org/api/application-config.html#iscustomelement>
        app.config.compilerOptions.isCustomElement = (tag) => tag === "mjml" || tag.startsWith("mj-");
    
        // Render the Vue instance to a variable as a string
        let html = await renderToString(app);
    
        // Remove <!--[--> and <!--]--> add by the server renderer.
        html = html.replace("<!--[-->", "").replace("<!--]-->", "");
    
        // Let mjml do its magic
        const res = mjml2html(html);
        return {
          statusCode: 200,
          headers: { "Content-Type": "html" },
          body: res.html,
        };
      } catch (error) {
        console.log(":rocket: ~ file: lambda.js ~ line 32 ~ handler ~ error", error);
        return {
          statusCode: 200,
          headers: { "Content-Type": "html" },
          body: null,
        };
      }
    } 
    The Error I get is this : { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module '../lib/utils.js'\nRequire stack:\n- /var/task/src/lambda.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js", "stack": [ "Runtime.ImportModuleError: Error: Cannot find module '../lib/utils.js'", "Require stack:", "- /var/task/src/lambda.js", "- /var/runtime/UserFunction.js", "- /var/runtime/index.js", " at _loadUserApp (/var/runtime/UserFunction.js:100:13)", " at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)", " at Object.<anonymous> (/var/runtime/index.js:43:30)", " at Module._compile (internal/modules/cjs/loader.js:999:30)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)", " at Module.load (internal/modules/cjs/loader.js:863:32)", " at Function.Module._load (internal/modules/cjs/loader.js:708:14)", " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)", " at internal/main/run_main_module.js:17:47" ] }
    t
    • 2
    • 4
  • s

    Sam Hulick

    12/01/2021, 2:44 AM
    so I just realized your Lambda func has to be in a VPC to use EFS. are there any drawbacks to this, for the Lambda func? will it break anything? I know that Lambdas in a VPC can’t access the outside Internet, but I don’t need that in this case
    t
    • 2
    • 14
  • s

    Sahan Amadoruge

    12/01/2021, 12:29 PM
    When writing integration test for an API. Do we need to create a new stack for it? Can anyone help me with this please? Checked the document. But found just a example about a unit test
    m
    t
    • 3
    • 5
  • s

    Sam Hulick

    12/01/2021, 5:01 PM
    is there any reason updating SST would cause a bunch of changes to various resources in my stack the next time I run
    yarn start
    ? it’s updating my RDS, KMS key.. kinda random stuff
    t
    f
    j
    • 4
    • 17
  • d

    Dan Van Brunt

    12/01/2021, 10:58 PM
    How does
    stack.resolve(thingy)
    work behinds the scenes? It seems to prevent any future changes to thingy using L2 methods?
    f
    • 2
    • 9
  • j

    Jonathan Chapman

    12/02/2021, 6:21 AM
    I've looked through the docs, but can't find how to set default tags for functions. I added datadog and want to set
    service
    ,
    env
    , and
    version
    tags, but not finding a good way to default them. Any pointers?
    f
    s
    • 3
    • 4
  • p

    Pavan Kumar

    12/02/2021, 12:21 PM
    I need to add permission to the lambda trigger. But following code doesn't run given the
    cognitoArn
    is null. How would I get around it or what is proper way to do it.
    Copy code
    const preSignUpFunction = new sst.Function(this, 'PreSignUp', {
          handler: 'users/auth/preSignUp.handler'
        })
        const userPool = new cognito.UserPool(this, "UserPool", {
          lambdaTriggers: {
            preSignUp: preSignUpFunction,
          }
        });
    
        const userPoolClient = new cognito.UserPoolClient(this, "UserPoolClient", {
          // ...
        });
    
        this.auth = new sst.Auth(this, 'Auth', {
          cognito: {
            userPool,
            userPoolClient,
          },
        });
    
        const cognitoArn = this.auth.cognitoUserPool?.userPoolArn;
    
        if (cognitoArn) {
          const permissions = [
            new iam.PolicyStatement({
              actions: [
                "cognito-idp:AdminCreateUser",
                "cognito-idp:AdminDeleteUser",
                "cognito-idp:AdminSetUserPassword",
                "cognito-idp:AdminDisableUser",
                "cognito-idp:AdminEnableUser",
                "cognito-idp:AdminUpdateUserAttributes",
              ],
              effect: iam.Effect.ALLOW,
              resources: [
                cognitoArn
              ],
            })
          ];
    
          preSignUpFunction.attachPermissions(permissions);
        }
    g
    o
    • 3
    • 8
  • o

    Omi Chowdhury

    12/02/2021, 2:54 PM
    About to start work on a feature that will probably use AWS Step Functions (SFN) - wanted to get the community’s read on serverless orchestration: • How do folks feel about SFN in production? • How’s latency at scale? Observability? Debugging? • Is it hard to write complex workflows? Been keeping an eye on some alternatives, but none seemed better enough to forgo SFN: • Temporal - I like their approach of defining workflows as code that gets executed instead of a DSL. Seems easier to reason about, for the same reason that I like CDK over CF’s JSON/YAML. Alas it has no support for Lambda, and executes its tasks in-house, but they have a cloud version. • Orkes Conductor - original engineers who built Netflix Conductor just started this co around it. Always though Conductor wasn’t suited for serverless, but they talk about Lambda support in their docs and a cloud version, so will be chatting with them soon
    g
    f
    a
    • 4
    • 10
  • j

    Julien Bras

    12/02/2021, 3:17 PM
    Hello! Playing with the new
    NextJs
    construct this week, and I found one nasty thing. I need to pass environment variables to the construct in order to provide Cognito User Pool Id and so but my Cognito User Pool is not built inside SST but in a different Cloudformation stack (with Serverless Framework). So I am using the
    Fn.importValue
    but this is not working 😄:
    Copy code
    // backend stack export prefix
        const backendStackPrefix = `sls-cust-center-backend-${scope.stage}`;
        console.log(`UserPool: ` + `${backendStackPrefix}-CognitoUserPool`);
        console.log(`UserPool: ` + Fn.importValue(`${backendStackPrefix}-CognitoUserPool`));
    
        // frontend application built using NextJs
        new NextjsSite(this, "NextSite", {
          path: "../frontend-next",
          environment: {
            NEXT_PUBLIC_API: Fn.importValue(`${backendStackPrefix}-ServiceEndpoint`),
            NEXT_PUBLIC_COGNITO_REGION: this.region,
            NEXT_PUBLIC_COGNITO_USER_POOL_ID: Fn.importValue(`${backendStackPrefix}-CognitoUserPool`),
            NEXT_PUBLIC_COGNITO_APP_CLIENT_ID: Fn.importValue(`${backendStackPrefix}-CognitoUserPoolClient`),
            NEXT_PUBLIC_COGNITO_DOMAIN: Fn.importValue(`${backendStackPrefix}-CognitoDomain`),
            NEXT_PUBLIC_COGNITO_IDENTITY_POOL: Fn.importValue(`${backendStackPrefix}-CognitoIdentityPool`),
          },
        });
    The value of the
    Fn.importValue
    is something like
    ${Token[TOKEN.351]}
    so it cannot be used for the
    next build
    part of the
    NextJs
    construct operation. Do you know how to deal with that elegantly? (I was thinking of calling ListExportsCommand in the Stack but this is not elegant for sure!) Thanks!
    f
    • 2
    • 11
  • d

    Daniel

    12/02/2021, 5:38 PM
    @Patrick Gold and @thdxr I’m having a newb moment. Where exactly did you add the bundle: nodeModules to clear up the pg-native error message? https://serverless-stack.slack.com/archives/C01J5QB8T6F/p1635355722021500?thread_ts=1635119264.009000&amp;cid=C01J5QB8T6F Thank you!
    p
    • 2
    • 2
  • d

    Devin

    12/02/2021, 5:55 PM
    I’m creating the following table within my stack:
    Copy code
    // Create the DynamoDB table
        const customersTable = new sst.Table(this, "Customers", {
          fields: {
            pk: sst.TableFieldType.STRING,
            sk: sst.TableFieldType.STRING,
            createdAt: sst.TableFieldType.STRING,
            customerId: sst.TableFieldType.STRING,
            email: sst.TableFieldType.STRING,
            firstName: sst.TableFieldType.STRING,
            lastName: sst.TableFieldType.STRING,
            phone: sst.TableFieldType.STRING,
          },
          primaryIndex: { partitionKey: "pk", sortKey: "sk" },
        });
    But i realized that
    [createdAt, customerId, email, firstName, lastName, phone]
    are all values that aren’t being indexed by dynamoDb they’re just values. Should I have them here?
    g
    b
    t
    • 4
    • 16
  • b

    Bshr Ramadan

    12/02/2021, 7:18 PM
    Hello, I was using 
    sst version 0.43.3
     and I've just updated to latest version after update I am facing this error:
    Copy code
    AccessDeniedException: User: arn:aws:sts::702716627781:assumed-role/bshr-cordova-CordovaPubli-publicCordovaGraphqlPric-SJHXCJ61EAQY/public-cordova-pricing-bshr is not authorized to perform: logs:DescribeLogStreams on resource: arn:aws:logs:us-east-1:702716627781:log-group:cordova-bshr:log-stream:
    this is the stack:
    Copy code
    const apiAuth = new sst.Auth(this, 'auth2', {
          cognito: {
            userPool: cordovaMainUserPool,
            userPoolClient: toledoClient
          },
          identityPool: {
            allowUnauthenticatedIdentities: true,
            identityPoolName: `api-identity-pool-${scope.stage}`,
          }
    });
    const publicApi = new sst.ApolloApi(this, 'publicCordovaGraphqlGateway', props);
    apiAuth.attachPermissionsForUnauthUsers([publicApi]);
    I tried
    sst remove
    and it didn't fix it
    f
    • 2
    • 4
  • s

    Sahan Amadoruge

    12/03/2021, 5:08 AM
    Anyone got this Warning `Warning: Ignoring extra certs from `/etc/pki/tls/certs/ca-bundle.crt``
    t
    • 2
    • 4
  • p

    Pavan Kumar

    12/03/2021, 6:14 AM
    Is there a way to deploy multiple stacks in parallel, in seed.run. For example, we have
    Copy code
    new StackA();
    new StackB();
    new StackC();
    new StackD();
    Scenario 1: Deploy all the stacks in parallel. Scenario 2: Deploy
    StackA
    and
    StackB
    in parallel and
    StackC
    and
    StackD
    depends on
    StackA
    and
    StackB
    hence deploy
    StackC and StackD
    in parallel, but in second stage?
    f
    a
    • 3
    • 8
  • m

    Mio Ttraja

    12/03/2021, 3:06 PM
    all I can write is this, in order to do anything, at least in my country in Serbia, they always advised me that it is necessary to have a vision of how it can actually work best, without requiring too much effort and time. And it helped me realize how much in electronics, chemistry, physics and programming actually works. So that foundation is the key to everything. Looking at these codes not only here but also beyond, I noticed that the function code is pretty much the same in all programming speeches. And the difference is that the creator of these program speeches foresaw something does not facilitate the work of the application itself. There are always some libraries that the application does not require, but they must be there. Therefore, in my opinion, for this here and something else, it would be necessary to think and make different compilers for machine code or the famous one has voltage, no voltage on the processor pins and so on. But also this, so that the processor itself doesn't always have to do everything, but each processor should do its job, and when needed, the main processor starts to help. So much for now all the best
    r
    j
    o
    • 4
    • 3
  • a

    Adrian Schweizer

    12/03/2021, 11:03 PM
    I really have to practice more with updating stacks...it almost always fails for some reason (e.g. when I change some dynamodb config), then I delete the tables through amazon gui, try again and it seems even worse than before, usually resulting in a stack that sits forever in delete pending
    d
    f
    ö
    • 4
    • 19
  • t

    Tonny (sstNerd)

    12/05/2021, 3:55 AM
    Good night everybody, I’m a newbie on TS and I have some questions but I wasn’t sure where to post this so I’m going for it in this channel. I’m trying to re-play the guide but TS driven now, that said I’m facing a few random issues that I’ve been able to figure out but this one. So basically this is how my ApiStack looks like:
    Copy code
    constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
        super(scope, id, props);
    
        const { table } = props;
    And then I’m getting TS errors b/c
    table
    is not a “typed” property under the
    sst.StackProps
    . That said, what would be the solution here? I was betting on create my own type (kinda like my own type but extending from the
    sst.StackProps
    somehow and also append a
    table
    property and whatever else need across the guide but idk if that’s how it should be in fact, any recommendation?
    r
    f
    • 3
    • 5
  • m

    Mischa Spiegelmock

    12/05/2021, 2:28 PM
    how do I add a default VPC to my functions? I have to create the VPC first but I’m getting
    Default function props for the stack must be set before any resources have been added.
    f
    t
    • 3
    • 13
1...333435...83Latest