Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Norm Johanson
    @normj
    @saliency That sample was written for .NET Framework which supports both sync and async versions of all of the service operations. In .NET Core only async versions of the API are supported because that is what the underlying HttpClient in .NET Core supports in .NET Standard 1.3 which is what the SDK targets to support for .NET Core.
    Renato Marinho
    @renatomarinho
    This message was deleted
    Daniel Laberge
    @DanielLaberge

    Just a heads up: The documentation for Amazon.Lambda.Logging.AspNetCore is wrong and misleading. (https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.Logging.AspNetCore#user-content-configuration)

    1. The appsettings.json example is wrong. It uses the section "Lambda.Logging", but the code at APIGatewayProxyFunction.CreateWebHostBuilder() uses "Logging": logging.AddLambdaLogger(hostingContext.Configuration, "Logging");

    2. The example for "Configuration through code" and Configuration through IConfiguration are also misleading because the LambdaLogger is actually configured by APIGatewayProxyFunction.CreateWebHostBuilder() by default. I was not able to override any settings other than by using appsettings.json with "Logging" as section name.

    The example in this blog post is also wrong for the same reasons.
    https://aws.amazon.com/blogs/developer/running-serverless-asp-net-core-web-apis-with-amazon-lambda/

    Also the provided example to filter Microsoft logs does not work, it has to be "Microsoft.*": "Information" to work, not "Microsoft": "Information".
    I spent a good hour trying to make it work until I finally looked at the source code and figured this out :worried:
    I can create an issue if you'd like.
    Norm Johanson
    @normj
    @DanielLaberge Yes, we should get that fixed up. Can you create an issue to track this issue?
    Daniel Laberge
    @DanielLaberge
    @normj Done. aws/aws-lambda-dotnet#275
    Norm Johanson
    @normj
    @DanielLaberge Thanks
    Renato Marinho
    @renatomarinho
    This message was deleted
    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)