Closed TerraVenil closed 7 years ago
Can you share your project.json file?
Sure. Default project.json which shipped with AWS .NET Core Template.
{
"version": "1.0.0-*",
"buildOptions": {
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"AWSSDK.S3": "3.3.4.1",
"AWSSDK.Rekognition": "3.3.0.1",
"Amazon.Lambda.Core": "1.0.0*",
"Amazon.Lambda.Serialization.Json": "1.0.1",
"Amazon.Lambda.S3Events": "1.0.0",
"Amazon.Lambda.Tools" : {
"type" :"build",
"version":"1.1.0-preview1"
}
},
"tools": {
"Amazon.Lambda.Tools" : "1.1.0-preview1",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
I fixed this issue. Only with "Newtonsoft.Json": "9.0.2-beta2"
deployment package works properly.
It was strange that you had Newtonsoft.Json in your tools section instead of dependencies. That might have confused dotnet publish
to not include it in the publish folder. When you changed to version 9.0.2-beta2 that was a different version then Amazon.Lambda.Serialization.Json specified and possible cleareddotnet publish
confusion.
Hi! I am trying to play with AWS Lambda functions based on https://aws.amazon.com/blogs/developer/using-the-aws-lambda-project-in-visual-studio/. When I execute last step and upload image in CloundWatch Log I see an exception `An exception was thrown when constructing the serializer type Amazon.Lambda.Serialization.Json.JsonSerializer. Check inner exception for more details.: LambdaException
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) Could not load file or assembly 'System.Runtime.Serialization.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.: FileNotFoundException 'System.Runtime.Serialization.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' not found in the deployment package or in the installed Microsoft.NETCore.App.: FileNotFoundException at AWSLambda.Internal.Bootstrap.LambdaAssemblyLoadContext.Load(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)`
My environment configuration are VS 2015 and setup AWS SDK, Publish to AWS based on https://aws.amazon.com/blogs/aws/new-aws-toolkit-for-visual-studio/.