satr / intellij-idea-plugin-connector-for-aws-lambda

The plugin for the IntelliJ IDEA: connector for AWS Lambda functions.
MIT License
14 stars 4 forks source link

Empty Function #16

Closed asyba closed 6 years ago

asyba commented 6 years ago

Hi I need help why the "Function" is empty. I have the correct JAR. The code need to have something special to be recognize by the plugin? Can you share some example of a java code that will work?

satr commented 6 years ago

Hi. The JAR will be evaluated on AWS server, when downloaded (only basic validation is performed in plugin - not zero size and that it is zip-archive), There is nothing special supposed to be in your logic, to upload JAR. You can also try to upload your JAR to AWS Lambda with AWS web-interface. To be able to AWS Lambda running your component - verify you specified correct handler function name in the field "Handler" (in the section "Function Configuration") Also check messages in the "Local Log" tab. The function dropdown box (wich I assume you mentioned) is populated from your list of functions. Please check following:

asyba commented 6 years ago

I have uploaded the JAR in AWS web-interface and test it and it works fine. Same profile and region.

In my local terminal it show the function: $ aws lambda list-functions --profile adminuser FUNCTIONS xxxxxxxxxxxxx 2671 Hello World arn:aws:lambda:us-east-xxxxxx:xxxxxxx:function:helloWorldJava helloWorldJava hello.world.aws.Hello::handleRequest2018-09-14T13:27:13.413+0000 xxx xxxxxxxxxxxxxxxxxxxxx arn:aws:iam::xxxxxxxxxxx:role/service-role/rolHelloWorldJava java8 15 $LATEST TRACINGCONFIG PassThrough VPCCONFIG
FUNCTIONS xxxxxxxxxxxxxxx

In Plugin Logs: INFO: FUNCTION is not selected.

asyba commented 6 years ago

I created the credentials with this: aws configure --profile adminuser (with the correct Access key and Secret key)

asyba commented 6 years ago

image

satr commented 6 years ago

Could you tell if this is correct:

asyba commented 6 years ago

Could you tell if this is correct:

  • in the "Profile" list - you should be able to see this profile and select it (hit "Refresh" to update the list)
  • In the "Region" list - the region is selected, where the AWS Lambda function is created
  • You do not work behind proxy. If you do - please setup proxi in IDEA settings
  • After hitting the "Refresh" button - you do not see your function (any functions) in the Function list?

I try this: (I dont have proxy) Yes the Function list is empty cant select anything, my region is us-east virginia. image 1

satr commented 6 years ago

Just to be sure - the function is in "arn:aws:lambda:us-east-1" - not in "us-east-2" (it is not seen in your info), correct? I do not see any reason the plugin does not show functions. I can suggest:

satr commented 6 years ago

I would also suggested in Local Log tab - set the log level from INFO to DEBUG

asyba commented 6 years ago

I would also suggested in Local Log tab - set the log level from INFO to DEBUG

I try restarting IDEA and also the PC, but same problem.

Changing the log to DEBUG the only interesting is this when I refresh the Function: DEBUG: Refresh list of AWS Lambda functions DEBUG: Refresh function list. DEBUG: Found 0 Java-8 functions. DEBUG: Function not set. DEBUG: Refresh role list. DEBUG: Found 0 roles. DEBUG: Refresh JAR-artifact list. INFO: Selected JAR-artifact: "helloWorld-1.0-SNAPSHOT.jar" INFO: Function is not selected.

satr commented 6 years ago

Please share the IDEA and plugin versions you use, I will try check on my side.

asyba commented 6 years ago

Please share the IDEA and plugin versions you use, I will try check on my side.

IntelliJ IDEA 2018.2 (Ultimate Edition) Build #IU-182.3684.101, built on July 24, 2018

Plugin Version: 1.6 & 1.7.RC2

asyba commented 6 years ago

Do i need a Main class? because i don't have one. And in this example you have one: https://github.com/satr/aws-amazon-shopping-bot-lambda-demo1/blob/master/src/io/github/satr/aws/lambda/shoppingbot/Main.java

satr commented 6 years ago

No, you do not need a Main class. That one was just for testing.

satr commented 6 years ago

I reproduced the issue. Please create also a profile with a name default I will trace why it is needed and fix it. I also apology I did not log in one particular catch to the Local File Thank you for reporting this.

satr commented 6 years ago

Please note - when you create a profile with aws CLI, key/secret is stored in the file .aws/credentials , but region and output format are stored in the file .aws/config. However, the region is not loaded from it automatically (this is why you may see "(no region)" next to the profile name). But if the region is put to the .aws/credentials within its profile (in text editor) - it is loaded fine. Probably I need to double-check my code in this logic as well.

satr commented 6 years ago

An issue has been fixed in the release v1.7.RC3