Aws-toolkit-jetbrains: KotlinNullPointerException when attempting to update lambda function code

Created on 8 Jan 2019  路  11Comments  路  Source: aws/aws-toolkit-jetbrains

Describe the bug
Attempted to update lambda function code.

To reproduce

  1. Right-click lambda in AWS Explorer
  2. Select "Update function code"
  3. After entering correct details on dialog, click Update

Expected behavior
Lambda function code updates (NOTE: This is a regression - it worked before when using plugin installed from marketplace)

Actual behavior
NPE - stack trace below

Your Environment

  • OS: Windows 10 Pro
  • JetBrains' Product: IntelliJ
  • JetBrains' Product Version: IntelliJ IDEA 2018.3.1 (Community Edition)
    Build #IC-183.4588.61, built on December 4, 2018
    JRE: 1.8.0_152-release-1343-b16 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  • Toolkit Version: latest master i.e. 4680063983d837f76f6e1d18506d846360a6c604
  • SAM CLI Version: SAM CLI, version 0.10.0
  • JVM/Python Version: Java 1.8.0_191 - Python v3.7.1

Additional context
Stacktrace:
kotlin.KotlinNullPointerException
at software.aws.toolkits.jetbrains.services.lambda.upload.EditFunctionDialog.viewToFunctionDetails(EditFunctionDialog.kt:301)
at software.aws.toolkits.jetbrains.services.lambda.upload.EditFunctionDialog.upsertLambdaCode(EditFunctionDialog.kt:246)
at software.aws.toolkits.jetbrains.services.lambda.upload.EditFunctionDialog.access$upsertLambdaCode(EditFunctionDialog.kt:66)
at software.aws.toolkits.jetbrains.services.lambda.upload.EditFunctionDialog$action$4.invoke(EditFunctionDialog.kt:103)
at software.aws.toolkits.jetbrains.services.lambda.upload.EditFunctionDialog$action$4.invoke(EditFunctionDialog.kt:66)
at software.aws.toolkits.jetbrains.services.lambda.upload.EditFunctionDialog$UpdateFunctionOkAction.doAction(EditFunctionDialog.kt:333)
at com.intellij.openapi.ui.DialogWrapper$DialogWrapperAction.actionPerformed(DialogWrapper.java:1831)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6548)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at java.awt.Component.processEvent(Component.java:6313)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4903)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:664)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.awt.Dialog.show(Dialog.java:1077)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:698)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:430)
at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1681)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1630)
at software.aws.toolkits.jetbrains.services.lambda.actions.UpdateFunctionAction.actionPerformed(UpdateFunctionAction.kt:29)
at software.aws.toolkits.jetbrains.services.lambda.actions.UpdateFunctionAction.actionPerformed(UpdateFunctionAction.kt:17)
at software.aws.toolkits.jetbrains.core.explorer.SingleResourceNodeAction.actionPerformed(AbstractActions.kt:42)
at software.aws.toolkits.jetbrains.core.explorer.ResourceNodeAction.doActionPerformed(AbstractActions.kt:66)
at software.aws.toolkits.jetbrains.components.telemetry.AnActionWrapper.actionPerformed(ActionWrappers.kt:39)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:258)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:275)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:287)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:277)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:522)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:35)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:544)
at java.awt.Component.processMouseEvent(Component.java:6548)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at java.awt.Component.processEvent(Component.java:6313)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4903)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:664)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

bug

Most helpful comment

1.1 is now public on JetBrains plugin repository

All 11 comments

Not able to reproduce this, but may be a symptom of #731, due to the fact that the NPE is because there is no IAM role selected

It might help to know that this is a regression from the version on the IntelliJ marketplace. I was able to update function code without issue there.

Is there some configuration I could do to try and work around this? It's currently blocking me so would appreciate some help getting back to productivity again. Thanks!

You could try pulling down https://github.com/aws/aws-toolkit-jetbrains/tree/abrooksv-fixLambdaUpload which was to fix your other reported issue

It looks like it was the same bug, the UI populates the IAM role given the existing function configuration, it is just hidden from your view. Since the exception was thrown (IAM error), the default value (current role) was null. This led to the NPE.

PR #732 should fix this issue as well

Thanks. I see the PR is merged. You guys work fast! I'll try the fix in the morning and report back.

It got included into the 1.1 release which is currently pending JetBrains' approval.

Can confirm that both this and #731 are working with latest version.

Thanks for the speedy replies and work! 馃憤

1.1 is now public on JetBrains plugin repository

I have the same issue

My Environment

OS: MacOS Mojave 10.14.3
JetBrains' Product: IntelliJ
JetBrains' Product Version:
IntelliJ IDEA 2019.1.3 (Ultimate Edition)
Build #IU-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202-release-1483-b58 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3
Toolkit Version:
AWS toolkit v1.4
AWS lambda java code updater v1.3
Connector for AWS Lambda v1.6
SAM CLI Version: SAM CLI, version 0.17.0
JVM/Python Version: Java 1.8.0_191 - Python v3.7.1
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

@nicolasrosado , are you seeing the error with the same exception stack trace? I couldn't reproduce the NPE issue myself. Can you provide more context for this? It's better to open a new issue if it is a different case.

Thanks for your return. I have the same stack trace but, finally, we finded the solution. We have test the command line from the AWS CLI instead from IntelliJ plugin AWS toolkit.

This is the result from the CLI :
_An error occurred (AccessDeniedException) when calling the UpdateFunctionCode operation: User: ... is not authorized to perform: lambda:UpdateFunctionCode on resource: ... with an explicit deny_

This mean that this stack strace on IntelliJ was due because we need granted access.
Tomorrow we will add this right and I will test on IntelliJ to be sure on that.

Was this page helpful?
0 / 5 - 0 ratings