Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71134

Null pointer exception fails lambda deployment

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • aws-lambda-plugin
    • None
    • dev to prod

      Lambda is getting deployed and developer checked it is fine but the job is failing with below error.

      14:20:16 Starting lambda deployment procedure 14:20:16 ERROR: Build step failed with exception 14:20:16 java.lang.NullPointerException: file 14:20:16 at java.base/java.util.Objects.requireNonNull(Objects.java:246) 14:20:16 at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:2387) 14:20:16 at org.apache.commons.io.FileUtils.readFileToByteArray(FileUtils.java:2467) 14:20:16 at com.xti.jenkins.plugin.awslambda.service.LambdaDeployService.getByteBufferAndDeleteFile(LambdaDeployService.java:387) 14:20:16 at com.xti.jenkins.plugin.awslambda.service.LambdaDeployService.getFunctionCode(LambdaDeployService.java:372) 14:20:16 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploader.upload(LambdaUploader.java:50) 14:20:16 at com.xti.jenkins.plugin.awslambda.callable.DeployCallable.call(DeployCallable.java:46) 14:20:16 at com.xti.jenkins.plugin.awslambda.callable.DeployCallable.call(DeployCallable.java:23) 14:20:16 at hudson.remoting.LocalChannel.call(LocalChannel.java:47) 14:20:16 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploadBuildStep.perform(LambdaUploadBuildStep.java:81) 14:20:16 Caused: java.lang.RuntimeException 14:20:16 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploadBuildStep.perform(LambdaUploadBuildStep.java:88) 14:20:16 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploadBuildStep.perform(LambdaUploadBuildStep.java:69) 14:20:16 at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) 14:20:16 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80) 14:20:16 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:47) 14:20:16 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818) 14:20:16 at hudson.model.Build$BuildExecution.build(Build.java:199) 14:20:16 at hudson.model.Build$BuildExecution.doRun(Build.java:164) 14:20:16 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:526) 14:20:16 at hudson.model.Run.execute(Run.java:1900) 14:20:16 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) 14:20:16 at hudson.model.ResourceController.execute(ResourceController.java:101) 14:20:16 at hudson.model.Executor.run(Executor.java:442) 14:20:16 Build step 'AWS Lambda deployment' marked build as failure 14:20:16 Finished: FAILURE

      when checked in ChatGPT i got this

      It looks like there is a NullPointerException in the Java code that is being executed during the deployment process. The stack trace shows that the exception is being caused by a call to FileUtils.openInputStream() in the LambdaDeployService class. The error message says "NullPointerException: file", which suggests that the file argument passed to that method is null.

      To determine which file is causing the issue, you may need to look at the source code for LambdaDeployService and see where the file argument is coming from. It could be that the file is being deleted or moved before the method is called, or there could be an issue with the file path or name.

      If you are not familiar with the codebase, you may need to consult with the developer or development team responsible for the code to get more information about the issue. They may be able to provide additional context or suggest a fix for the problem.

          [JENKINS-71134] Null pointer exception fails lambda deployment

          Mark Waite added a comment -

          The AWS Lambda plugin was last released 6 years ago. If you would like a fix to the issue that you're seeing, you will probably need to adopt the plugin, modernize it, fix the issue, and release a new version.

          Mark Waite added a comment - The AWS Lambda plugin was last released 6 years ago. If you would like a fix to the issue that you're seeing, you will probably need to adopt the plugin , modernize it , fix the issue, and release a new version .

          varun added a comment -

          i don't own the plugin and don't know the fix either.
          which plugin do you recommend for lambda deployments from jenkins for nodejs apps markewaite 

          varun added a comment - i don't own the plugin and don't know the fix either. which plugin do you recommend for lambda deployments from jenkins for nodejs apps markewaite  

          Mark Waite added a comment -

          Adopting the plugin is a way to take ownership of the plugin when it is no longer being developer by the previous maintainer. I have never used AWS Lambda. I assume there is a command line interface that will allow you to deploy to AWS Lambda. You could call the command line interface from the Jenkins Pipeline. https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-awscli.html seems to describe command line access to AWS Lambda.

          Mark Waite added a comment - Adopting the plugin is a way to take ownership of the plugin when it is no longer being developer by the previous maintainer. I have never used AWS Lambda. I assume there is a command line interface that will allow you to deploy to AWS Lambda. You could call the command line interface from the Jenkins Pipeline. https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-awscli.html seems to describe command line access to AWS Lambda.

            cast Michael Willemse
            varun118 varun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: