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>)'.
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.
@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.
Can anyone help me on
-- Custom Header not being added at final HTTP response - APIGatewayHttpApiV2ProxyResponse class from AWS .NET Lambda SDK
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
@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!)
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).
@normj I am trying to follow this article (https://aws.amazon.com/blogs/developer/net-5-aws-lambda-support-with-container-images/) and running into the below error. I am trying to do this from an EC2 instance. I have suspicions about not having Hyper-V available. Can the procedures in this article be completed in an EC2 Windows instance?
docker build: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=buildtools2019%3Alatest&target=&ulimits=null&version=1": open //./pipe/docker_engine: The system cannot find the file specified