Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Aniket Braganza
    @aabragan
    I am using .NET Core 2.0 and would like to use the aws-sam-cli
    1. Do I have to use Windows containers or Linux containers?
    2. Anyone have experience, examples etc on how to implement local lambda testing with the aws-sam-cli
      TIA
    Norm Johanson
    @normj
    @aabragan Under the covers aws-sam-cli uses linux based docker containers.
    Question for those looking for local Lambda debugging solutions. Is your main goal you want a quick an easy way to step through your code or setup a local version of your function for other parts of your application to call/integrate?
    Dan Guisinger
    @dguisinger
    hello, does anyone have a suggestion on how to generate a CodeDeploy appspec yaml target version number during compiling of a .NET Core lambda function using CodeBuild?
    hounddog22030
    @hounddog22030
    @dguisinger Do you mean an Assembly Version Number?
    Dan Guisinger
    @dguisinger
    @hounddog22030 .... i was looking at the code deploy documentation for lambda functions and it needs both a CurrentVersion and TargetVersion number in the appspec.yaml file packaged with the build... I'm now looking at SAM. it looks like using a CloudFormation step instead of CodeDeploy may work better, CloudFormation automates calling CodeDeploy behind the scenes and apparently figures out the versioning details on its own.... rather annoying that if you wanted to use CodeDeploy from pipeline directly that you have to know those details about your lambda versions....
    hounddog22030
    @hounddog22030
    @dguisinger Sure, that will work. You don't have to use SAM to get that. You can do a straight Lambda function.
    hounddog22030
    @hounddog22030
    What version of Microsoft.AspNetCore.All does AWS lambda support? I know I tried to update it a while back and had issue....
    Naing Ye Lin Thein
    @naingyelin

    @hounddog22030 after I migrated to asp.net core2.1

    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0"/>
    <PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" />
    <PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="1.1.3" />
    <PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="2.0.4" />
    <PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.2.0" />

    <!-- <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
    <PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.4" />
    <PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="2.0.3" /> -->

    Norm Johanson
    @normj
    @hounddog22030 Only version of Microsoft.AspNetCore.All supported in the .NET Core 2.1 runtime is 2.1.0. It should be updated soon.
    Naing Ye Lin Thein
    @naingyelin
    @hounddog22030 migrating to new meta package aspnet/Announcements#287
    hounddog22030
    @hounddog22030
    Anyone know how to control the verbosity of the logging in aspnet running in aws lambda? is it an aws lambda configuration or an aspnet core configuration? (Ours is too chatty)...
    Naing Ye Lin Thein
    @naingyelin

    asp.net logging is controlled by settings in the appsettings.json,

    {
      "Logging": {
        "LogLevel": {
          "Default": "Debug",
          "System": "Information",
          "Microsoft": "Information"
        }
    }

    or you can configure it programmatically in Startup.cs, https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1

    hounddog22030
    @hounddog22030
    @naingyelin thanx, i'll check it out
    kanchwala-yusuf
    @kanchwala-yusuf

    Hi All,

    I have a lambda function which calls REST APIs. I am getting a '404 Client Error: Not Found for url.

    But, I am able to access the url from my local machine.

    Also, the lambda function can access the internet. I am doing a couple of things which requires internet access.

    Is there anything that I may be missing...?

    Would appreciate any help here?

    Thanks. :)

    Kevin J. Petersen
    @kevinjpetersen
    Is this chat room still active? :D
    Norm Johanson
    @normj
    @kevinjpetersen It hasn't been very active but there is no reason it can't be active again :)
    Christian Kütbach
    @ckuetbach
    Hi there, I have a question about compatibility. I made a template project based on the aws template and I get some kind of warning (NETSDK1071), that templat is based on net-core app 2.1.5. Not I try to remove the warning, but I am confused, if it is ossible at all.
    I am not sure if the <RuntimeFrameworkVersion> within the csproj would be a good approach: d-velop/dvelop-app-template-cs#22
    Norm Johanson
    @normj
    What do you mean by a template project?
    Aniket Braganza
    @aabragan
    @normj I have been trying to get dot net lambda layers working but constantly get errors about it not finding the dlls. I pulled all external dlls except my own into a separate zip to make the layer zip. I have tried a combination of things including putting the dlls in a bin folder, in the lib/<.net version folder> and also the base folder in the zip but it just won't find them and i invariable get cloudwatch logs telling me it can't find the dependency. I made sure the layer was added to my lambda too. Any ideas? I am struggling to see how I can use it right now.
    Norm Johanson
    @normj
    @aabragan Have you taken a look at by layer branch for the Amazon.Lambda.Tools global tools. I'm working on building support into the tooling. https://github.com/aws/aws-extensions-for-dotnet-cli/issues/58#issuecomment-456704842
    Aniket Braganza
    @aabragan
    @normj I have not but I will look at it right away.
    Aniket Braganza
    @aabragan
    @normj we are not using serverless. we use azure devops for the pipeline in combination with terraform. I assume that should not be an issue since you are bolting it into lambda tools right?
    Norm Johanson
    @normj
    @aabragan As long as you use Amazon.Lambda.Tools to create your package bundle you should be good once it is released. Although you are welcome to build it locally and try it out. I think the branch is feature complete, I need to update the docs and get everything reviewed.
    Aniket Braganza
    @aabragan
    @normj so the new lambda tools with support for layers is out in nuget? If so I will pull it down and give it a shot. Thanks for the update!
    Aniket Braganza
    @aabragan
    Would it be possible to enhance the AWS Lambda Json Serializer such that we could specify custom serialization settings? I know the serializer is loaded through reflection. Is the only way to accomplish this, to build my own serializer and set this up in there?
    e.g.
            private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                Formatting = Formatting.None,
                MissingMemberHandling = MissingMemberHandling.Ignore,
                DefaultValueHandling = DefaultValueHandling.Ignore
            };
    Norm Johanson
    @normj
    @aabragan The layer support isn't released to NuGet yet. I have the PR out now so hopefully soon.
    Norm Johanson
    @normj

    @aabragan We could do like we did for passing in custom converters https://github.com/aws/aws-lambda-dotnet/blob/07ce8b4f06c12e96f357c1647575a63b66d206af/Libraries/test/TestFunctionFSharp/FSharpJsonSerializer/FSharpJsonSerializer.cs

    Have a constructor that takes in a JsonSettings. Then you could extend the the serializer and pass your JsonSettings to the base constructor. Then use your serializer in the Lambda serializer attribute.

    Aniket Braganza
    @aabragan
    @normj I thought about basically building my own serializer that wraps the Amazon one. I could have defined the serializer settings in that and modified the base one but that newtonsoft serializer is not exposed. Additionally, there is no way to pass parameters into the constructor via the assembly attribute, but that's not as important. I ended deciding to build my own serializer (that is essentially a clone of the Amazon one with some additional bits on it) which I am currently testing out. It may be useful to make the newtonsoft serializer protected or have a constructor that allows one to pass the settings in along with the converters. Thoughts? Would it be possible to branch the repo and PR that change for you to review?
    Aniket Braganza
    @aabragan
    Maybe something like this:
            /// <summary>
            /// Constructs instance of serializer.
            /// </summary>
            public JsonSerializer() : this(null, null)
            {
            }
    
            /// <summary>
            /// Constructs instance of serializer using custom converters.
            /// </summary>
            public JsonSerializer(IEnumerable<JsonConverter> converters)
                    : this(converters, null)
            {
            }
    
            /// <summary>
            /// Constructs instance of serializer using custom converters and custom serialization settings.
            /// </summary>
            public JsonSerializer(IEnumerable<JsonConverter> converters, JsonSerializerSettings settings)
            {
                if (settings == null)
                    settings = new JsonSerializerSettings();
    
                settings.ContractResolver = new AwsResolver();
                serializer = Newtonsoft.Json.JsonSerializer.Create(settings);
    
                if (string.Equals(Environment.GetEnvironmentVariable(DEBUG_ENVIRONMENT_VARIABLE_NAME), "true", StringComparison.OrdinalIgnoreCase))
                {
                    this.debug = true;
                }
    
                if (converters != null)
                {
                    foreach (var c in converters)
                    {
                        serializer.Converters.Add(c);
                    }
                }
    
            }
    Aniket Braganza
    @aabragan
    then I could do something like this:
        /// <summary>
        /// Custom Json Serializer based on Amazon's implementation
        /// </summary>
        public class CustomJsonSerializer : JsonSerializer
        {
            private static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                Formatting = Formatting.None,
                MissingMemberHandling = MissingMemberHandling.Ignore,
                DefaultValueHandling = DefaultValueHandling.Ignore
            };
    
            /// <summary>
            /// Constructs instance of serializer using custom serialization settings.
            /// </summary>
            public CustomJsonSerializer() : base(null, SerializerSettings)
            {
    
            }
        }
    Andrew Shaw Care
    @andrewshawcare
    I'm using EFCore in an AWS lambda function and it looks like it's taking up to 30 seconds to initialize the context... is there an example Lambda function that integrates with EFCore?
    hounddog22030
    @hounddog22030
    We use EF CORE and do nothing special. What memory size is your function? What DB are you connecting to? What the “instance type” of the DB server?
    Aniket Braganza
    @aabragan
    @andrewshawcare We used to run into load time issue with EFCore too. We actually switch to use SqlKata (https://sqlkata.com) for our data access and use a dedicated lambda to do data access. It uses Dapper under the covers I believe.
    Christian Kütbach
    @ckuetbach

    Hi there... I use a URL Rewrite to make use a Lambda behind a reverse proxy. (/acme/abc should execute <lambda>/prod/acme/abc). This works fine, but within my code I create an Url with the UrlHelper. Running on my local maschine everything seems to be fine (The link is created as /acme/xyz) but when running within Lamba it ist created as /prod/acme/xyz.

    Any Ideas?

    https://github.com/d-velop/dvelop-app-template-cs/commit/b4be5bfc5d71801124850906b998d9468677fe53#diff-b070eb406f87f97d9900f275b4c9a67bR113

    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?
    tobymiller1
    @tobymiller1
    @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 :))