aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.57k stars 478 forks source link

Publish to AWS Lambda - Upload button does not activate #271

Closed bbawol closed 6 years ago

bbawol commented 6 years ago

I am no longer able to publish a .NET Core lambda to AWS. This was working fine just last week and stopped somewhere around Thursday May 3. My project builds, I'm able to select "Publish to AWS Lambda", All of the AWS Lambda options populate in the "Upload to AWS Lambda" dialog box on the first screen (the drop down shows all of my lambdas etc.) I can then click 'Next' to get to the screen where the role is selected (again, I see all of the roles and can select one with no problem) however nothing I do on this screen enables the 'Upload' button.

I am able to use the .NET Core CLI to compile a lambda function package/.zip and upload that via the AWS web UI as a work-around for now.

I have uninstalled AWS Toolkit from VS 2017 Professional, restarted VS 2017, re-installed the Toolkit via the Extensions manager, yet I'm still having the same problem.

I have tried creating an entirely new .NET Lambda project with the latest AWS Toolkit installed and attempted to publish that to my AWS account, this new basic project exhibits the same issue and I'm unable to upload that as well.

I've also tried creating a new test function in AWS thinking it might have something to do with my AWS function however when I select that new function as the publish destination it still does not enable the Upload button.

I have tried to publish with and without Environment Variables in my configuration, I've tried to change the selections in the drop-down lists in the publish dialog box thinking that may trigger the Upload button, none of this works.

Below is the About Visual Studio information containing version info and extensions installed etc.

Thanks!

================================================

Microsoft Visual Studio Professional 2017 Version 15.7.0 VisualStudio.15.Release/15.7.0+27703.1 Microsoft .NET Framework Version 4.7.02556

Installed Version: Professional

Application Insights Tools for Visual Studio Package 8.12.10405.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.0.40501.0 ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 15.7.31476 Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.60419.0 For additional information, visit https://www.asp.net/

AWS Toolkit for Visual Studio 2017 1.14.3.0 AWS Toolkit for Visual Studio 2017. Copyright 2011-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://aws-vs-toolkit.s3.amazonaws.com/versioninfo.html

This software includes third party software subject to the following copyrights:

Azure App Service Tools v3.0.0 15.0.40424.0 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.3.3000.5 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 15.0.40502.0 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.3.3000.5 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 2.8.0-beta6-62830-08. Commit Hash: e595ee276d14e14bfb3eb323fb57f2aa668bddea C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter 15.7.18116.1 Provides tools for finding, instantiating and customizing templates in cookiecutter format.

GitHub.VisualStudio 2.5.1.2234 A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JetBrains ReSharper Ultimate 2018.1 Build 112.0.20180414.70444 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.

Microsoft Azure HDInsight Azure Node 2.3.3000.5 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.3.3000.5 Language service for Hive query

Microsoft Azure Stream Analytics Language Service 2.3.3000.5 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10420.2

Microsoft Continuous Delivery Tools for Visual Studio 0.3 Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Node.js Tools 1.4.11027.3 Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 4.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

Python 15.7.18116.1 Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Django support 15.7.18116.1 Provides templates and integration for the Django web framework.

Python - IronPython support 15.7.18116.1 Provides templates and integration for IronPython-based projects.

Python - Profiling support 15.7.18116.1 Profiling support for Python projects.

R Tools for Visual Studio 1.3.40402.1027 Provides project system, R Interactive window, plotting, and more for the R programming language.

ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools 15.1.61804.210 Microsoft SQL Server Data Tools

Supercharger 1.2.0.945 Extend Visual Studio with CodeMAP, Intelligent Code Flow Lines, Code Highlighters, SuperFind, Rich Code, Magic Comments etc. More info: http://supercharger.tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 15.7.20419.2003 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.8.0-beta6-62830-08. Commit Hash: e595ee276d14e14bfb3eb323fb57f2aa668bddea Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.1 for F# 4.1 15.7.0.0. Commit Hash: 16ecf5a30ad868d183c58e4a71a71c23d4ed3ba9. Microsoft Visual F# Tools 10.1 for F# 4.1

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

stevejroberts commented 6 years ago

Thanks for letting us know. Can you take a look at the toolkit's log file and see if any obvious errors are being reported there? The log exists at %userprofile%\AppData\Local\AWSToolkit\logs.

bbawol commented 6 years ago

I do see a couple errors.

System.IO.FileNotFoundException: Could not find file 'C:....[path-to-project]\project.json'.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) at System.IO.File.ReadAllText(String path) at Amazon.AWSToolkit.Lambda.WizardPages.PageUI.UploadFunctionDetailsPage.InitializeControlForNETCore(String sourcePath)

Then another error after that is as follows:

System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Amazon.AWSToolkit.Lambda.View.Components.KMSKeySelectorControl.BuildAliasedKeyList(IEnumerable1 keys, IEnumerable1 aliases) at Amazon.AWSToolkit.Lambda.View.Components.KMSKeySelectorControl.SetAvailableKMSKeys(IEnumerable1 keys, IEnumerable1 aliases, KeyAndAliasWrapper[] serviceDefaults, KeyListEntry initialSelection) at Amazon.AWSToolkit.Lambda.WizardPages.PageUI.UploadFunctionAdvancedPage.SetAvailableKMSKeys(IEnumerable1 keys, IEnumerable1 aliases, String defaultArn) at Amazon.AWSToolkit.Lambda.WizardPages.PageControllers.UploadFunctionAdvancedPageController.OnKMSKeysAvailable(IEnumerable1 keys, IEnumerable`1 aliases) at Amazon.AWSToolkit.SimpleWorkers.QueryKMSKeysWorker.WorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

stevejroberts commented 6 years ago

We're having trouble reproducing this issue. Either of those issues could potentially cause the page to disable the Upload button.

As a test, are you able to deploy a new project (our 'empty function' blueprint for example), to rule out any settings specific to this particular project?

bbawol commented 6 years ago

Hi Steve,

Yes, I have tried to deploy a new project ('empty function') as well as deploy a new/empty project to a new Lambda function I created in AWS. I have attempted this both before uninstalling the AWS Toolkit as well as after uninstalling and re-installing the Toolkit, no luck either way.

Do you have any other recommendations I should try?

stevejroberts commented 6 years ago

So both old and new test projects fail to work in the wizard? Have you made any changes with respect to kms keys recently?

bbawol commented 6 years ago

I have not done anything with my keys, it appears to be configured properly in the AWS console.

Within VS 2017 I'm also able to use the AWS explorer with no issues, I've also verified that my AWS account has full access (specifically "AWSLambdaFullAccess")

stevejroberts commented 6 years ago

It's always possible the error is being triggered elsewhere but I want to rule out the kms key one first - do you have any custom kms keys, outside of the aws/ prefixed ones?

Enablement of the upload button is controlled by all required fields on the page being set - currently this is timeout, memory, iam role and if a vpc is selected, vpc subnet and security group. Outside this, the upload button also stays disabled while background threads are running to query data for some of these fields. We don't clear the counter for the workers until after the kms keys field has been updated so it's possible if this is the error source then as far as the page is concerned, there is still a worker active somewhere.

Question is, why is a duplicate key error getting triggered for you and not us. Assuming no leak of information, can you paste into the issue the kms key aliases you see listed when you go to the iam console?

bbawol commented 6 years ago

Could this be due to the fact that there are no keys in the list in the dialog? I looked in my AWS console on the web site and the list of available KMS keys in the function configuration does not show any duplicates.

Here is the latest log debug info for my new/empty lambda project I just created:

2018-05-08 13:08:50,472 [1] ERROR Amazon.AWSToolkit.Lambda.WizardPages.PageUI.UploadFunctionDetailsPage - Error searching for default assembly in C:\Users\brian\source\repos\AWSLambda2\AWSLambda2 System.IO.FileNotFoundException: Could not find file 'C:\Users\brian\source\repos\AWSLambda2\AWSLambda2\project.json'. File name: 'C:\Users\brian\source\repos\AWSLambda2\AWSLambda2\project.json' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) at System.IO.File.ReadAllText(String path) at Amazon.AWSToolkit.Lambda.WizardPages.PageUI.UploadFunctionDetailsPage.InitializeControlForNETCore(String sourcePath) 2018-05-08 13:08:52,959 [1] INFO Amazon.AWSToolkit.MobileAnalytics.SimpleMobileAnalytics - Queuing analytics event in local queue with timestamp: 05/08/2018 20:08:52 2018-05-08 13:08:52,959 [1] INFO Amazon.AWSToolkit.MobileAnalytics.SimpleMobileAnalytics - Queuing analytics event in local queue with timestamp: 05/08/2018 20:08:52 2018-05-08 13:08:53,010 [1] INFO Amazon.AWSToolkit.S3FileFetcher - Null/empty hosted files location override 2018-05-08 13:08:53,010 [1] INFO Amazon.AWSToolkit.S3FileFetcher - Loading hosted file 'flags/us.png' from local path 'C:\Users\brian\AppData\Local/AWSToolkit/downloadedfiles/flags/us.png' 2018-05-08 13:08:53,071 [1] INFO Amazon.AWSToolkit.S3FileFetcher - Null/empty hosted files location override 2018-05-08 13:08:53,072 [1] INFO Amazon.AWSToolkit.S3FileFetcher - Loading hosted file 'AccountTypes.xml' from local path 'C:\Users\brian\AppData\Local/AWSToolkit/downloadedfiles/AccountTypes.xml' 2018-05-08 13:08:53,072 [1] INFO Amazon.AWSToolkit.S3FileFetcher - Null/empty hosted files location override 2018-05-08 13:08:53,072 [1] INFO Amazon.AWSToolkit.S3FileFetcher - Loading hosted file 'AccountTypes.xml' from local path 'C:\Users\brian\AppData\Local/AWSToolkit/downloadedfiles/AccountTypes.xml' 2018-05-08 13:09:00,573 [92] INFO Amazon.AWSToolkit.CommonUI.WizardFramework.AWSBaseWizardImpl - Querying KMS keys 2018-05-08 13:09:00,573 [1] INFO Amazon.AWSToolkit.MobileAnalytics.SimpleMobileAnalytics - Queuing analytics event in local queue with timestamp: 05/08/2018 20:09:00 2018-05-08 13:09:01,170 [92] INFO Amazon.AWSToolkit.CommonUI.WizardFramework.AWSBaseWizardImpl - Querying KMS key aliases 2018-05-08 13:09:01,274 [1] FATAL Amazon.AWSToolkit.ToolkitFactory - Unhandled exception System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Amazon.AWSToolkit.Lambda.View.Components.KMSKeySelectorControl.BuildAliasedKeyList(IEnumerable1 keys, IEnumerable1 aliases) at Amazon.AWSToolkit.Lambda.View.Components.KMSKeySelectorControl.SetAvailableKMSKeys(IEnumerable1 keys, IEnumerable1 aliases, KeyAndAliasWrapper[] serviceDefaults, KeyListEntry initialSelection) at Amazon.AWSToolkit.Lambda.WizardPages.PageUI.UploadFunctionAdvancedPage.SetAvailableKMSKeys(IEnumerable1 keys, IEnumerable1 aliases, String defaultArn) at Amazon.AWSToolkit.Lambda.WizardPages.PageControllers.UploadFunctionAdvancedPageController.OnKMSKeysAvailable(IEnumerable1 keys, IEnumerable`1 aliases) at Amazon.AWSToolkit.SimpleWorkers.QueryKMSKeysWorker.WorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

bbawol commented 6 years ago

Here is the list of KMS Keys that I see on the web site, these do not show up in the Publish wizard.

KMS key to encrypt in transit

I don't know if this is relevant but the section "KMS key to encrypt at rest" has an additional key called "aws/lambda" which does not exist in the "KMS key to encrypt in transit" list.

stevejroberts commented 6 years ago

Can you try the test build below (v1.14.3.1)? I've added extra guards around the code that seems to be implicated in the error trace.

https://steveataws.s3.us-west-2.amazonaws.com/test-releases/AWSToolkitPackage.1.14.3.1.vsix?AWSAccessKeyId=AKIAJYH5DPUXMUQNTPUA&Expires=1526423040&Signature=U9Zagv2N%2BDu5i1AYSwk4Yy%2B33JI%3D

bbawol commented 6 years ago

Hi Steve, that worked! I uninstalled the Extension and installed the version you provided, I now see all of my KMS Keys listed and when I select one the "Upload" button activates. Should I simply continue using the version you provided me or do you need me to do anything else to continue testing?

stevejroberts commented 6 years ago

Great, thanks for letting us know. You can keep using the build I sent while we prep a patch release (I'll update the issue when that's done).

stevejroberts commented 6 years ago

Fix released in v1.14.3.2, apologies for the issue.