Aws-toolkit-jetbrains: Deploy to AWS Lambda for Node.JS / WebStorm

Created on 8 Sep 2018  路  8Comments  路  Source: aws/aws-toolkit-jetbrains

The core plugin exposes two extension-points that enable deployment of an AWS Lambda.

  • aws.toolkit.lambda.packager builds the appropriate zip-file for the specific runtime; extensions implement LambdaPackager.
  • aws.toolkit.lambda.handlerResolver contains logic for marking PsiElements as potential lambda handler methods (this is used to create a gutter icon which exposes the 'deploy to Lambda' action). Extensions implement LambdaHandlerResolver

We need an implementations of these for Node.js that follow the AWS Lambda packaging instructions : https://docs.aws.amazon.com/lambda/latest/dg/nodejs-create-deployment-pkg.html

feature-request new-language-support ready-for-beta-testing

Most helpful comment

please add Webstorm to the roadmap of this plugin!
馃檹

All 8 comments

most likely this would be achieved through SAM CLI

please add Webstorm to the roadmap of this plugin!
馃檹

Would love to get some feedback on the progress we've made towards WebStorm support. An early preview build of the WebStorm functionality can be found here :

aws-jetbrains-toolkit-1.6-webstorm-beta-3.zip

Download the zip and use the "Install from Disk..." option to install the plugin into WebStorm or your Node enabled IntelliJ IDE.

Alternatively if you'd prefer to build from source yourself do the following:

git clone https://github.com/aws/aws-toolkit-jetbrains.git
cd aws-toolkit-jetbrains
git checkout feature/webstorm-support
./gradlew buildPlugin

This will produce a zip in the build/distribution folder - use this to install from disk.

Currently this supports the same feature set as Python & Java, namely:

  • Create new project
  • Step-through debug locally
  • Deploy serverless application

Similar to the other language-support in the toolkit there are some required dependencies see the documentation here.

Please post back to this issue if you have feedback.

@kiiadi (WebStorm 2019.2.2) Downloaded aws-jetbrains-toolkit-1.6-webstorm-beta-3.zip and am having trouble installing. Which file should be selected within zip folder to install plugin?

Only one I could get to go through was aws-intellij-toolkit-core-1.6-webstorm-beta-3.jar

When IDE restarts get the following error:

Plugin 'aws.toolkit' failed to initialize and will be disabled. Please restart WebStorm.

java.lang.NoClassDefFoundError: software/aws/toolkits/core/utils/LogUtilsKt
at software.aws.toolkits.jetbrains.services.telemetry.DefaultTelemetryService.(TelemetryService.kt:117)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.getDelegate(ServiceManagerImpl.java:259)
at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.getComponentImplementation(ServiceManagerImpl.java:192)
at org.picocontainer.defaults.BasicComponentParameter.resolveAdapter(BasicComponentParameter.java:108)
at org.picocontainer.defaults.BasicComponentParameter.isResolvable(BasicComponentParameter.java:71)
at org.picocontainer.defaults.ComponentParameter.isResolvable(ComponentParameter.java:122)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getGreediestSatisfiableConstructor(CachingConstructorInjectionComponentAdapter.java:133)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:81)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:66)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:48)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:481)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$load$7(ApplicationImpl.java:414)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:414)
at com.intellij.idea.IdeaApplication.lambda$executeInitAppInEdt$5(IdeaApplication.java:150)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:438)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: software.aws.toolkits.core.utils.LogUtilsKt PluginClassLoader[aws.toolkit, 1.6-webstorm-beta-3] com.intellij.ide.plugins.cl.PluginClassLoader@39510af1
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:75)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 36 more

BTW, also tried from source and am getting the following error when trying to build.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':buildSrc'.

    Could not open cp_proj remapped class cache for bxx9208b66q2ivbczu81csros (/Users/homefolder/.gradle/caches/5.4.1/scripts-remapped/build_ej7qz29kqucx3ym9ez8l4isn0/bxx9208b66q2ivbczu81csros/cp_projdcd040730888da95d185715568c9cc57).
    Could not open cp_proj generic class cache for build file '/Users/homefolder/WebstormProjects/aws-toolkit-jetbrains/buildSrc/build.gradle' (/Users/homefolder/.gradle/caches/5.4.1/scripts/bxx9208b66q2ivbczu81csros/cp_proj/cp_projdcd040730888da95d185715568c9cc57).
    BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 23s

@charliecode In the IDE, when you select Install from Disk, select the zip file itself.

Your build issue looks to be running too new of a JDK.

@kiiadi Major bug: Webstorm 2019.2.2

Created a small Lambda Function within my already created app (not Serverless). When I choose "Create new AWS Lambda" and fill out all the appropriate fields, most notably "Handler:" and add where the handler is located, which is a single small file and click "Create Function" it creates a new .aws-sam folder at the root of my app. That folder contains not the single small lambda function I created, but rather my entire app, causing my system to prompt me to "add" my entire app (all files) to git. The function is also never loaded to lambda because it's way too large. The file is successfully loaded to S3, but again, it's not the single Lambda function I created but rather my entire app.

Major bug: Webstorm 2019.2.2

Thank you for opening https://github.com/aws/aws-toolkit-jetbrains/issues/1223 let's move the discussion for this there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

schapsl picture schapsl  路  5Comments

michaelschem picture michaelschem  路  3Comments

maranqz picture maranqz  路  4Comments

eshanaka picture eshanaka  路  5Comments

flyinprogrammer picture flyinprogrammer  路  4Comments