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

    Artemiy Davydov

    03/18/2022, 8:30 AM
    Please add following to the documentation: 1) About caching functions. (After changing the function, at least 5 minutes must pass, otherwise you will not see the changes) 2) About bypassing circular dependencies 3) It is necessary to duplicate the CORS headers in the lambda function response (if it hasn't been mentioned anywhere else) It would have saved me 3 days of searching. I think it should help the others a lot too.
    f
    a
    • 3
    • 5
  • a

    Artemiy Davydov

    03/18/2022, 10:00 AM
    I finally understood the main problem. The CORS error says that even in the preflight request we are getting
    Access-Control-Allow-Origin: *
    , but there is a different value there.
    Copy code
    allowOrigins: [
              "<http://localhost:3000>",
              "<https://domain1>",
              "<https://dev.domain1>",
            ],
    f
    • 2
    • 9
  • u

    Uncharted

    03/18/2022, 1:41 PM
    Hello everyone ! I was wondering if someone tried to use injection like inversifyjs with SST ? I tried to implement an API with a route targeting the code below but got an error like it doesn't find/resolve but it works if I instantiate the class without injection
    Copy code
    export interface IService {
      handle(event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult>;
    }
    
    @injectable()
    export class TestInject implements IService {
      public async handle(event: APIGatewayProxyEvent) {
        console.log('test inject');
        return {
          statusCode: 200,
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ success: true }),
        };
      }
    }
    
    const service = myContainer.get<IService>(TYPES.IService);
    export const handle = service.handle;
    Result:
    Copy code
    Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read property 'name' of undefined","reason":"TypeError: Cannot read property 'name' of undefined","promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read property 'name' of undefined","    at process.<anonymous> (file:///home/uncharted/projects/my-api/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (events.js:376:20)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:96:32)"]}
    a
    a
    f
    • 4
    • 22
  • m

    Michael Robellard

    03/18/2022, 7:36 PM
    Hey everyone, I want to create a route on my Python API that uses a large package (Pandas) that none of my other routes need. Is there a standard way to do this in SST so that my other packages don't all end up with Pandas as a dependency. If I add it to the requirements.txt for my api that gets loaded it will end up everywhere which would be a cosmic waste of resources. Any suggestions would be greatly apprciated
    a
    t
    f
    • 4
    • 10
  • s

    satish venkatakrishnan

    03/19/2022, 1:41 PM
    Is there any plan to support .net 6 as it is officially supported runtime in aws lambda now . Also how many dotnet users here.
    f
    • 2
    • 6
  • s

    Sebastian Kline

    03/19/2022, 8:30 PM
    I’m building an api which Stripe will redirect to in order to subscribe the user after confirming payment details. I have an AuthStack setup which allows for the use of AWS IAM authorization when making requests to my api. I am wondering, if the user has previously authenticated via IAM in the browser, will the authorization still be valid if I direct the user to Stripe, then Stripe redirects back to the api (protected by IAM authorization)?
    f
    • 2
    • 3
  • s

    satish venkatakrishnan

    03/20/2022, 4:36 AM
    Is there a way to give the AWS region information and API gateway url as a environment variable to Aws Lambda
    m
    f
    • 3
    • 5
  • b

    Bshr Ramadan

    03/20/2022, 11:05 PM
    I am getting this error after updating to 0.69.2
    Copy code
    This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.        
    (Cloud assembly schema version mismatch: Maximum schema version supported is 14.0.0, but found 16.0.0)
    f
    a
    t
    • 4
    • 12
  • t

    Theo Ballew

    03/20/2022, 11:55 PM
    Hey all! Was trying to get up and running with the websocket api construct, tried the following: • npx create-serverless-stack@latest --example websocket • cd websocket • npm run start and ran into the following error:
    t
    • 2
    • 3
  • g

    Gabriel Araújo

    03/21/2022, 2:50 AM
    https://serverless-stack.slack.com/archives/C01JG3B20RY/p1639782415403600 i had this same problem
    f
    t
    • 3
    • 3
  • t

    Ted Mader

    03/21/2022, 6:12 AM
    I’m interested in refactoring some existing resources to a separate stack, notably a
    Distribution
    . Are there any examples/guides on how to do this with SST?
    f
    • 2
    • 6
  • s

    satish venkatakrishnan

    03/21/2022, 9:01 AM
    Is there a example for creating preSigned url for S3
    m
    r
    • 3
    • 12
  • m

    Meris Tarhanis

    03/21/2022, 2:28 PM
    What to do in case of this error? I am new to the technology
    f
    • 2
    • 7
  • a

    Adrian Schweizer

    03/21/2022, 4:09 PM
    So what are you guys doing to keep your lambda code organized? Any specific frameworks or patterns? So far I'm going freestyle, and it works quite well, but I'm not sure if I'll be able to still handle the project when it gets much larger.
    t
    t
    +2
    • 5
    • 28
  • s

    Shah Hossain

    03/21/2022, 4:53 PM
    Hi all, I am trying to enable AWS X-Ray for my SST app. Is there an updated version of this guide that would work with SST?
    f
    • 2
    • 4
  • m

    Meris Tarhanis

    03/21/2022, 5:33 PM
    How do I query a table using global Indexes?
    r
    f
    • 3
    • 4
  • d

    David Garcia

    03/21/2022, 5:35 PM
    Hey there, following up here. Still dealing with this issue. My latest comments have narrowed down the root cause of the issue. https://serverless-stack.slack.com/archives/C01JG3B20RY/p1647536454769239?thread_ts=1643127297.129100&amp;cid=C01JG3B20RY There's also a discrepancy in the documentation at this link: https://docs.serverless-stack.com/constructs/Function#python-runtime-1 Specifically: "You can override this behavior by passing in the
    installCommands
    through the FunctionBundlePythonProps." This doesn't seem to be correct, passing in installCommands doesn't stop the step that installs poetry, pipenv, or pip. It's not an override, because the script with the passed in commands is passed in afterwards, as seen here in this dockerfile https://github.com/serverless-stack/serverless-stack/blob/master/packages/resources/assets/python/Dockerfile.dependencies This bundling behavior leads to certificate errors, with no clear way for resolution. If it was possible to have custom commands run before external deps are pulled in order to add required certs, then I believe this issue would be alleviated
    f
    • 2
    • 19
  • b

    Boris Tane

    03/21/2022, 5:54 PM
    probably a dependency issue but when I start a new project and a create an
    sst.Bucket
    inside a class that extends
    cdk.Construct
    I get the following error
    new Bucket(_this_, "Bucket");
    Copy code
    Type 'ConstructNode' is missing the following properties from type 'Node': _locked, _children, _context, _metadata, and 6 more.
    here are the deps:
    Copy code
    "devDependencies": {
        "@aws-cdk/aws-iam": "^1.149.0",
        "@aws-cdk/aws-ssm": "^1.149.0",
        "@serverless-stack/cli": "0.69.2",
        "@serverless-stack/resources": "0.69.2",
        "@tsconfig/node14": "^1.0.1",
        "@types/aws-lambda": "^8.10.70",
        "@types/node": "<15.0.0",
        "aws-cdk-lib": "2.15.0",
        "typescript": "4.4.4"
      }
    any pointers please?
    r
    t
    c
    • 4
    • 10
  • a

    Austin

    03/21/2022, 7:33 PM
    Is it possible to configure multiple custom domains on the
    sst.StaticSite
    construct? I’m using it to build a multi-purpose reverse proxy/redirect engine for several of our domains. StaticSite provides some convenience I would like to leverage, but I also need the CloudFront distribution to allow multiple custom domains. When I configure it directly on the
    cfDistribution
    I get an error telling me to use
    customDomain
    on the
    sst.StaticSite
    but this doesn’t appear to allow multiple domains. Any suggestions?
    t
    • 2
    • 15
  • s

    Sven Busse

    03/22/2022, 9:41 AM
    Hello. I was just updating sst from version 0.65.5 to 0.69.2 and now when I run
    sst test
    I get an error:
    Cannot find module 'regenerator-runtime'
    And also Typescript is not able to find jest anymore. Is there an upgrade instruction somewhere?
    j
    • 2
    • 2
  • m

    Mischa Spiegelmock

    03/22/2022, 6:29 PM
    Export mish-platform-Layers:ExportsOutputRefPrismaLayer958161C6A54DA9DC cannot be updated as it is in use by mish-platform-CacheAdminService, mish-platform-CandidateListService and mish-platform-CandidateMatchService (and 8 more)
    f
    • 2
    • 18
  • a

    Austin

    03/22/2022, 7:01 PM
    Is there any way to enable Origin Shield with
    sst.StaticSite
    ?
    f
    • 2
    • 4
  • a

    Artemiy Davydov

    03/22/2022, 7:15 PM
    Does anyone know how to get Cloudwatch lambda function metrics through code?
    f
    • 2
    • 3
  • a

    AR

    03/22/2022, 7:40 PM
    im using the EventBus construct, am getting an error about the node env
    Copy code
    3. node_modules/@serverless-stack/node/config/index.js (63, 6) - Top-level await is not available in the configured target environment ("node14")
    Copy code
    new sst.EventBus(props.stack, "bus", {
        rules: {
          plaid_hook: {
            eventPattern: { source: ["plaid.hook"] },
            targets: ["core/connection/plaid.sync"],
          },
        },
      });
    I can invoke the event in the console but am getting this error when invoking:
    Copy code
    ✘ [ERROR] Top-level await is not available in the configured target environment ("node14")
    
        node_modules/@serverless-stack/node/config/index.js:63:6:
          63 │     : await load();
             ╵       ~~~~~
    Copy code
    export async function sync() {
      return JSON.stringify({ some: "data" });
    }
    t
    f
    • 3
    • 3
  • m

    Michael Holroyd

    03/22/2022, 8:20 PM
    I'm trying to use
    prisma
    along with
    sst
    in a simple API. Prisma requires access to this
    schema.prisma
    file -- how can I include that extra file to be packaged up with the code during deployment?
    t
    • 2
    • 3
  • k

    Kristian Lake

    03/22/2022, 8:43 PM
    hey guys, using a custom domain and having some issues. // Create the API this.api = new sst.Api(this, "Api", { customDomain: scope.stage === "prod" ? "example.com" : undefined, ... // Show the API endpoint in the output this.addOutputs({ ApiEndpoint: this.api.customDomainUrl || this.api.url, }); I can see the hosted zone in route 53 and it looks fine, but i get this error running npx sst deploy --stage prod [Error at /prod-Example-api/Api] Found zones: [] for dns:com, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone Found errors It seems you are configuring custom domains for you URL. And SST is not able to find the hosted zone "com" in your AWS Route 53 account. Please double check and make sure the zone exists, or pass in a different zone. Any ideas? 🙂
    a
    f
    • 3
    • 59
  • k

    Kristian Lake

    03/23/2022, 12:39 AM
    still struggling. im on the frontend bit now. been trying to figure this out for a while now 😕 lol. I already have a hosted zone but its already got a NS and SOA, not sure if this is causing me issues.
    f
    • 2
    • 32
  • a

    Ayo

    03/23/2022, 1:11 AM
    Hey so I created a new hostedzone on route53 to be my api base url and when I try to deploy, I get this error. Is anyone familiar with this and how to solve?
    f
    • 2
    • 6
  • s

    Sebastian Kline

    03/23/2022, 1:48 AM
    Any tips on how manage schema changes to dynamodb using SST?
    f
    • 2
    • 7
  • k

    Kristian Lake

    03/23/2022, 1:57 AM
    pff - not having a great night lol... Preparing your SST app ✘ [ERROR] Could not resolve "@aws-cdk/aws-apigatewayv2" stacks/ApiStack.js331: 3 │ import { CorsHttpMethod } from "@aws-cdk/aws-apigatewayv2"; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "@aws-cdk/aws-apigatewayv2" as external to exclude it from the bundle, which will remove this error.
    f
    • 2
    • 9
1...596061...83Latest