IntelliJ + AWS Toolkit + Serverless App: "Must be able to locate the handler in the project in order to deploy to Lambda" - intellij-idea

I have created a new Serverless project in IntelliJ using a HelloWorld style template app.
This app I managed to build, deploy and run remotely in my AWS account. I even managed to integrate it with API gateway to make it accessible through the internet.
As the project is setup, it has 1 Lambda function called HelloWorldFunction. Its handler is called "helloworld.App::handleRequest" and I can see the configuration for this in the template.yaml file.
Now I want to create another Lambda function in the same application project. So, in IntelliJ, I follow these steps:
AWS Explorer > Lambda
Right-click on Lambda
Click "Create new AWS Lambda ..."
enter a function name (e.g. MyNewLambdaFunction)
enter the runtime (Java 8) and the S3 bucket and the IAM role (all is fine)
then I need to enter the name of the "Handler", and this is where my problem starts
I have tried different names here, such as "MyNewHandler", or "helloworld.App::handleRequest" (clearly this wouldn't work because it's already in use by the HelloWorldFunction), "helloworld.App2::handleRequest", .... and so on.
Each time I try another name or way to define the Handler, I get this error message:
Must be able to locate the handler in the project in order to deploy
to Lambda
Question:
Do I need to first configure the new Lambda function in the template.yaml file or what do I need to call the Handler so it will work?
I am sure this is just a noob-error but I have been Googling this and haven't found anyone who has run into the same problem. I also read up on AWS on handlers but it only describes it at a conceptual level and not in practice where there are multiple Lambdas.
thanks for any help!
Andy

My understanding is that you would need to add app2 class to the same package first:
click on the package name → new → Java Class → type app2
Navigate to the implementation of the App2 class and click on the lambda icon in the gutter. You will notice that "Create New AWS Lambda" is added to the dropdown:
When you select it, you will see that "Handler:" field has already been prepopulated correctly:
my understanding is that each handler must be placed in a separate class and the name of the handler handleRequest is standard and provided by the framework

I've had the same issues using pyCharm for Python.
I was able to solve it by using <file name without extension>.<function name> so my file is app.py and the function is lambda_handler so my handler was app.hello_world
It should be noted this is the same as what you see in the "Handler" field when using the AWS web management page.

Thius is how it looks in pycharm:

I got the same issue but solved in a different way;
Quit WebStorm
Delete ".aws-sam" and ".idea" folders
Open the project again.
"Update function code" run without "Must be able to locate the handler in the project in order to deploy to Lambda"

Related

Missing cli.json file when creating a new Vue project using Amplify

Missing cli.json file when creating a new Vue project using Amplify. I am following the official tutorial
I get as far as Initialize a new backend and run amplify init:
Initializing finishes with the following (it does not matter whether I answer yes or no to the share information on failure message):
And here's the file structure:
I also notice that the aws-exports.js file was not created. Oddly enough, the aws-exports.js file is listed in the .gitignore file.
I have tried a few times to create a new project, in VS and in the windows console. I have also tried creating the Vue app using Vue 2 and 3 and come up against the same issue.
In my final attempt, I came across the same issue but proceeded to "successfully" add the graphQl API but this error was displayed when I ran amplify push to update the backend:
An error occurred during the push operation: /
The AWS Access Key Id you provided does not exist in our records
I presume this is because the aws-exports.js file that contains the access key does not exist?
I'd appreciate any help in sorting this out.
thanks
solved!
I mistakenly created the project within another project.

Adobe analytics with vue js adding external script

Im struggling to add adobe analytics external scripts to my Vue js project. The client uses Adobe analytics and im battling to add it to the project without the project complaining.
The external adobe script looks like the following:
//assets.adobedtm.com/file.min.js with async
Then it is required that you end it by adding the following just before the closing body tag:
<script type="text/javascript">_satellite.pageBottom();</script>
When the project starts it complains in console that $ is not defined because it is defined in webpack when i start the project and im guessing its not finding the alias.
This is the error:
VM29714:3 Uncaught ReferenceError: $ is not defined
Then further down it complains that it doesnt know what _satellite is:
login:54 Uncaught ReferenceError: _satellite is not defined
I just need the scripts and satellite close to be added to the project, the rest will work once these are added.
Ive tried added the scripts by injecting them into the head tag on runtime but that also doesnt work.
If you are implementing Adobe DTM, you cannot inject the header script dynamically. It must be placed directly on the page without async or deferred attributes.
If you are implementing Adobe Launch, you can inject the header script dynamically and asynchronously. And if you do this, you do not include the footer (_satellite.pageBottom()) code.
Your script example isn't explicit, but the .min portion implies you are using Adobe Launch.
VM29714:3 Uncaught ReferenceError: $ is not defined
This is not directly related to either Adobe DTM or Launch. You may possibly have some other script or code block deployed inside the DTM or Launch interface that references $, but that's a separate issue to work out. Yes, it may be coming from a DTM or Launch script according to the js console, but keep in mind that DTM/Launch is a tag manager. It hosts and deploys other tags/scripts. So you need to do some digging to see which tag/script from which Rule references it. Start by looking at the stack trace to find out where it's coming from.

IntelliJ System.out.println() - Cannot resolve method println(java.lang.String)

I am using IntelliJ IDEA, learning Java. All went well until yesterday, when the mentioned error occurred.
I didn't make any changes. I was looking for the solution the following ways:
reboot the pc
restart IntelliJ.
delete the project directory and use another one (both on desktop)
nothing helps. buy running simple hello world method. It keeps showing this error:
Is there someone able to help me?
ok, is solved.
file -> invalidated caches / Restart
One reason for this to happen is if you have print statement somewhere on the body of the class, and not inside a method.
Here is an example:
But if the print is inside a method, it should work fine.
Here is an example:
I think if you have tried the method above, maybe you can consider where you use System.out.println() because this method should only used in main(String args[]){},the latest version of the Idea is OK. I wish what said can help you.
If you have orcale sdk configured as your project sdk there is no way System.out.println can't be found - besides you are using another System.out.
So my guess is that you don't have a proper project sdk configured.
Goto to Project Settings or press Ctrl+Alt+Shift+S, go to Project Settings -> Project and check if your sdk is setup correctly.
In my case my project was set up to Java 6th and I had installed jre1.8.0_131 which I assume was causing the problem. After changing Java to level 8 problem have been solved.
Press Ctrl+Alt+Shift+s or go to File -> Project Structure -> Project, and set Project Language Level to yours.
case 1: if all sdk setup is complete and perfect
then
file -> invalidated caches / Restart
this could work
case 2 : if something missing in sdk setup of intelij
then goto
1.file->project structure->libraries
2.click on + button
3. add location of lib folder of tomcat directory
C:\xampp\tomcat\lib
to add lib directory to tomcat
import static java.lang.System.out;
Or do you possibly have more than one class named System?
Or possibly this link could be of use to you.
Just make sure that your SDK in the setting of INTELIJI is set up have a look here
I had that problem because I pulled the repository from work where we have java 8, but on my private computer, I have 17..

WSO2 Identity / How to Register XACML PIP Java Extension and its Claims

Scanning through the WSO2 documentation and several blogs, I found three different type of registry mechanisms to add new claims to a Java PIP module:
By use of setup file calledentitlement.properties and by adding of Java static properties for each variable as described in the
sample case from the WSO2 manual, see: Writing a Custom Policy Info Point;
By use of supportedAttributesIds.add as described in link How to write a PIP point for WSO2 IS;
By use of a setter method: public Set getSupportedIds() { Set<String> ids = new HashSet<String>(); ids.add("http://kmarket.com/id/role"); return ids; } as described in the Stackoverflow post How To Add User Defined Attribute in PIP Attribute User Store
Please instruct which of the three options is the updated and recommended solution for adding new fields produced by the lookup of external data sources executed by the Balana PIP as an extension of the "AttributeFinderModule" class.
I've also tested the code posted in this example and compiled it with Java 6 JDK, see source reference
How To Add User Defined Attribute in PIP Attribute User Store
After the restart, the WSO2 server continues to display the following error:
Error while loading entitlement policies. Exception occurred while trying to invoke service method getAllPolicies
The following error details are available. Please refer logs for more details.
org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getAllPolicies
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.handleException(EntitlementPolicyAdminServiceClient.java:478)
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.getAllPolicies(EntitlementPolicyAdminServiceClient.java:81)
at org.apache.jsp.entitlement.index_jsp._jspService(org.apache.jsp.entitlement.index_jsp:183)
when adding the extended AttributeFinder Java extension. Is this a known bug in the WSO2 server?
The first way is configurable, you don't need to rebuild and deploy the PIP when you want to add new attibute. You just have to add them to entitlement.properties file. and restart the IS.
In other two ways, you have to rebuild the PIP module for each attribute changes.
But, If you are going to add and attribute, you have to implement the logic for that too, so in that case going for last two ways also make sense.
I've replaced the KmarketPIPAttributeFinder program module by the latest version from the svn source repository (see link below) and compiled it. This solved the problem under WSO2 Identity Server Version 5 and the routine started to register the PIP attributes, now visible at the PDP extensions.
Download the latest code from: https://svn.wso2.org/repos/wso2/carbon/platform/trunk/components/identity/org.wso2.carbon.identity.samples.entitlement.pip/src/main/java/org/wso2/carbon/identity/samples/entitlement/pip/KmarketPIPAttributeFinder.java

Error after publishing .net web project

I am publishing a project in my local computer, I am getting an error because of the path of the files, in my project I am using relative path, but when i published the project I specified a Site/application so I put: localhost/myapp, but then, after the login the additional name myapp make it loses the path references, do you have any idea how to go through this?
I encountered the same problem with my web application this problem occurs because in your application you are hardcoding paths for ex :- /Home/Index or something which creates problems whenever you want to provide paths use helpers like #Url.Action(),#Html.Action(),#Url.Content() as shown below :-
#Url.Action("Index","Home",new{//specify route parameters here//})
If you are using areas in you application then specify it as :-
#Url.Action("Index","Home",new { area="myarea" })