Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Christian Kütbach
    @ckuetbach
    OK, I am a step further ... it works, but I'd like to know, why the PathBase is set: [Debug] Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction: ASP.NET Core Request PathBase: /prod, Path: /acme-apptemplatecs/
    I guess it is because the /prod of API Gateway should be omitted. In this case resetting the PathBase to / the solution, because my Reverse-Proxy adds /prod to the requests.
    Piotr
    @karpikpl
    Hi,
    the code of conduct mentions "Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation." but I don't see a build on the PR.
    Is there something I'm missing?
    Thiago Delgado
    @thiagodelgado111
    Hi folks, quick question, is there a recommended way to deploy a set of lambdas and a gateway api using the lambda tool? (custom runtime, netcore 2.2)
    Erik O'Leary
    @onionhammer
    So now netcore 3 is out, when is official runtime support coming?
    tobymiller
    @tobymiller
    @onionhammer I'm trying to get dotnet core 3 working in lambda too, but I don't think they'll do an official runtime release as 3.1 (scheduled for November) will be the LTS release, not 3.0
    I'm wondering if anyone's built a custom layer with a runtime for dotnet core 3.0 that mimics the official runtimes by parsing the handler and loading the appropriate class and method?
    FordyceGarfield
    @FordyceGarfield

    Are there any tricks to get the LambdaLogger to log the request id with every message? The closest I've gotten is by using scopes. This gives me a consistent ID for every message within a request, but this is not the actual requestid that AWS generates (see below). I've tried turning on EventIDs, but this doesn't appear to do anything useful. I'm on Amazon.Lambda.Logging.AspNetCore 2.3.0.
    Example:

    START RequestId: 0398a3a7-a36f-47c4-acf8-62baf867b25c Version: $LATEST [Information] RequestId:0HLQ7DJ3PSAU1...

    I'm looking to have both of RequestIDs to be the GUID assigned by AWS.

    hounddog22030
    @hounddog22030
    Anyone have any thoughts on this: aws/aws-aspnet-cognito-identity-provider#131
    James Bright
    @jbright
    @FordyceGarfield I wrote my own simple logger to do this. It's not elegant, but basically a very simple class that you can initialize with the request id and each of my services will use that to log their messages. I could not find any of the existing logging solutions that did this out of the box. (I also set up a log level that was bound to an environment variable so that I could control what level of detail to log, since we do millions of lambda executions per day and that can get expensive if you log too much information.)
    FordyceGarfield
    @FordyceGarfield
    @jbright Thanks for the feedback! I guess we'll bark up that tree.
    benbward
    @benbward
    @FordyceGarfield I'm using scopes, but I'm using the ILambdaContext.AwsRequestId property on the context object that is passed into the function. Will that work?
    hounddog22030
    @hounddog22030
    If there's anything I can do to help speed up support for .net core 3.1 (about 1 month out).... please let me know.... https://dotnet.microsoft.com/download/dotnet-core/3.1
    Christopher Johnston
    @chrisj-au
    Quick Q. When building a web api, is there any advantage to write it as a standard application (simple handler) over a web api with controllers etc? I find that it's a bit of work getting DI working on a standard application when trying to add systemsmanager (or i'm not smart enough :))
    ssureshraja
    @ssureshraja
    @Edu115 Could you please help me as I'm hitting the same issue. Added all libraries but still get the GDI type initializer exception
    jdavis-leasehawk
    @jdavis-leasehawk
    I see commit activity is still ongoing trying to get .NET 3.1 support up and going. Thank you @normj for your hard work, waiting in anticipation
    not that we as a company are going crazy in need for it .. we're not .. just have in our backlog a story "update to .net core 3.1" all of our projects, which are .net core 2.2, with one project sitting in lambda and .net core 2.1 that is holding everything up .. lol ..
    Christian Kütbach
    @ckuetbach

    Hi ... I get an error, while starting my application within the lambda testtool:

    System.MissingMethodException: Method not found: 'Microsoft.AspNetCore.Hosting.IWebHostBuilder Microsoft.AspNetCore.Hosting.IWebHostBuilder.ConfigureAppConfiguration(System.Action`2<Microsoft.AspNetCore.Hosting.WebHostBuilderContext,Microsoft.Extensions.Configuration.IConfigurationBuilder>)'.

    Am I missing a nuget package?
    Ohh and thanks for the 3.1 support
    kevinsunsh
    @kevinsunsh
    Is there a document or sample code to show how C# lambda function can work with a native library?
    Tushti Ahuja
    @Tushti02
    Hi,
    Can anyone guide in -
    When is it best to use WebApi template over Empty Lambda template for serverless applications?
    What are the best recommendations for choosing a template basis busniess scenarios/costs/package size/Start Time etc?
    hounddog22030
    @hounddog22030
    @Tushti02 I think your question is too broad. What are you trying to do specially?
    Tushti Ahuja
    @Tushti02

    I have implemented a serverless lambda function which is to be invoked by API Gateway, but I am asked to use WebApi template. I don't understand how would choosing this template would be better. The api gateway SAM configuration any way takes care of hitting that lambda function. Besides, that lamda is simply responsible to insert data into a table.

    Kindly enlighten me on questions above and the above scenario considering the best practices.

    hounddog22030
    @hounddog22030
    @Tushti02 - So you question is which "Blueprint" to use in Visual Studio for your scenario after selecting a "Serverless" project?
    hounddog22030
    @hounddog22030

    @normj - what's your thoughts on the following statements?

    This page titled "Using Amazon Logging Frameworks with AWS Lambda" describes AWS Lambda logging patterns: https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/cw-log-frameworks.html

    But, when you goto any of the links in the last line, "The AWS .NET logging plugins are a new open source project on GitHub. All of the plugins are there, including samples and instructions on how to configure CloudWatch Logs for each of the supported .NET logging frameworks.", they lead you to a project with a readme.md that reads "When using Lambda it is recommended to use either the ILambdaContext.Logger.LogLine or the Amazon.Lambda.Logging.AspNetCore package."

    In other words, it seems the bulk of the page "https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/cw-log-frameworks.html" is bad advice, because it is demonstrating a pattern which is not recommended.

    I feel as though I have wasted a couple of days because of this because I missed this callout in the readme.md not to use them with AWS Lambda. BTW, wasted days because I couldn't not figure out why the log events were not being written. Ironically, they do seem to get flushed with the next call to the lambda function, so the last set of entries is always missing.

    @normj - BTW, what I want to do is create a single CloudWatch Log for a stack and have all functions write to it. So it looks like I'll use the Amazon.Lambda.Logging.AspNetCore, but it isn't clear to me how to create a specific CloudWatch Log Group in order to achieve that goal.
    Richard Silveira
    @RichardSilveira

    Hi,
    Can anyone help me on
    -- Custom Header not being added at final HTTP response - APIGatewayHttpApiV2ProxyResponse class from AWS .NET Lambda SDK

    https://stackoverflow.com/questions/63744500/custom-header-not-being-added-at-final-http-response-apigatewayhttpapiv2proxyr

    hounddog22030
    @hounddog22030
    @RichardSilveira - posted some ???s on your thread
    Zhiwei
    @ChihweiLHBird
    I am a beginner, and I am setting up a test REST API for lambda. I created an empty Lambda function project in Visual Studio 2019, but I don't know why I cannot do using Amazon.Lambda.APIGatewayEvents;
    Severity Code Description Project File Line Suppression State Tool Error CS0234 The type or namespace name 'APIGatewayEvents' does not exist in the namespace 'Amazon.Lambda' (are you missing an assembly reference?) TableReadyAWSRestaurantsInfoLambda C:\Users\zhiwe\source\repos\TableReadyAWSRestaurantsInfoLambda\TableReadyAWSRestaurantsInfoLambda\Function.cs 7 Active Compiler
    Anyone know what was going wrong?
    hounddog22030
    @hounddog22030
    @ChihweiLHBird - Sounds like you're missing a package reference. Did you use a template/blueprint or are you starting from scratch?
    Zhiwei
    @ChihweiLHBird
    @hounddog22030 Thank you very much. After installing the NuGet packages, it works! Have a great weekend.
    Alberto Corrales Garcia
    @albertocorrales
    Hi guys, I'm trying to run lambda power tool for my dotnet core lambda web api. For that I need to get the Request that is coming to the lambda, so I can send the same body in lambda power tool. Do you know what is the best way to get that resquest for dotnet lambda web api? Looking at the implementation, I think I need the object APIGatewayProxyRequest that is used by class APIGatewayProxyFunction. Is that OK? Thanks in advance
    2 replies
    hounddog22030
    @hounddog22030
    Hugh Phoenix-Hulme
    @HughPH

    @hounddog22030 might seem weird, try increasing the memory available to the function. You get more CPU if you allocate more memory. It says so in the FAQs (but not the page that the FAQs link to for "more information")

    My situation: With 128MB memory, first invocation takes 9 seconds(!!!!) and subsequent invocations take avg 600ms(!!!!), the function doesn't use more than 100MB memory, but setting to 384MB, first invocation takes <3 seconds and subsequent invocations take avg 60ms. So on a GB-second basis it costs 1/3rd as much to run with 384MB allocated, and the function completes within a reasonable time. (600ms is not a reasonable time for an API!)

    Hugh Phoenix-Hulme
    @HughPH

    It's no wonder stuff runs like a dog with 128MB memory:

    Lambda allocates CPU power in proportion to the amount of memory configured. Memory is the amount of memory available to your Lambda function at runtime. You can increase or decrease the memory and CPU power allocated to your function using the Memory (MB) setting. To configure the memory for your function, set a value between 128 MB and 10,240 MB in 1-MB increments. At 1,769 MB, a function has the equivalent of one vCPU (one vCPU-second of credits per second).

    https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html

    Deep Hathi
    @deephathi
    Hi Everyone, I am a newbie in aws lambda world. I have a question that let's say I want to fetch 100 records from dynamodb and for each record, I want to product json payload one at a time to other lambdas via step functions then how to achieve that? I understood that lambdas are functions that take input and produce output, however I am not clear on how would I produce a steam of json output for each data-store record. Could you please guide me on this?
    Produce, understand
    hounddog22030
    @hounddog22030
    @deephathi - your question is pretty architectural, not as much technical. That being said, it isn't even clear how the step functions are involved. But, if you want to pass json as a payload to another function, you will need to invoke the function using the lambda client (https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/Lambda/TLambdaClient.html). And then Invoke (https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/Lambda/MLambdaInvokeInvokeRequest.html). When Invoke(ing), pay close attention to InvocationType. My feeling is that if you are invoking something 100 times, you'll to use the Event value, otherwise you will need to wait for the 100 functions to complete, which seems unlikely.
    @deephathi - Another alternative is to post the Json onto a SQS queue that the function(s) are tied to.
    Deep Hathi
    @deephathi
    Thank you @hounddog22030 . We have various components deployed on lambdas and are orchestrator together via step functions. However, the launcher component will fetch like 100 records from dynamodb and then would fire the whole workflow for every record by converting them into individual events. Will check links and yes, the approach of posting events on SQS queue sounds like a good fit for this.
    hounddog22030
    @hounddog22030
    We have a Lambda aspnet component deployed behind api gateway. We use cognito for authentication in the api gateway. Can we just forgo the authenticator in API Gateway and use app.UseAuthentication() and [Authorize(Roles = "xxx")] as in https://aws.amazon.com/blogs/developer/now-generally-available-the-asp-net-core-identity-provider-for-amazon-cognito/ ? What might be the down side to that?
    Norm Johanson
    @normj
    @hounddog22030 You can use ASP.NET Core auth features. I have done it before and it worked fine. The pros are it keeps things pretty simple using basically standard ASP.NET Core features. The benefit of usnig separate cognito authorizer with API Gateway is you separate your concerns and offload all authentication/authorization to API Gateway.
    hounddog22030
    @hounddog22030
    Thanks Norm... The only downside I can think of is that an unauthorized attack on your API could run your bill up....
    John
    @johnlee
    I'm trying to create a basic WebAPI app using APIGW and Lambda (SAM). On APIGW we need to setup the proxy resource. I noticed this is set at the root. Is it possible to create the proxy on a sub-resource? For example, the "RootResouce" = "mysubpath1/" instead of "/"? Essentially I'm curious if I can deploy multiple SAM apps to use the same APIGW but each app be in its own subpath. Thank you!
    hounddog22030
    @hounddog22030
    Man, Norm, It sure would be nice if Lambda Functions support DI to the constructors! ;-)