question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(pipelines): custom step in Java

See original GitHub issue

Creating a custom step in the new CDK pipelines API in Java throws a JSIIException

Reproduction Steps

Follow the recommended guidelines for implementing a custom step using the new API: https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/pipelines/README.md#arbitrary-codepipeline-actions

public class LambdaStep extends Step implements ICodePipelineActionFactory {

    Function fn;

    public ExecEc2ImagePipelineLambdaStep(Construct scope, @NotNull String id) {
        super(id);

       String fnCode = "exports.handler = async (event) => {console.log('event: ', event)}";
       this.fn = Function.Builder.create(this, "Fn")
                                                               .runtime(Runtime.NODEJS_14_X)
                                                               .handler("index.handler")
                                                               .code(Code.fromInline(fnCode).build()

    }

    @Override
    public @NotNull CodePipelineActionFactoryResult produceAction(@NotNull IStage iStage, @NotNull ProduceActionOptions produceActionOptions) {
        iStage.addAction(new LambdaInvokeAction(
                LambdaInvokeActionProps.builder()
                                       .lambda(this.fn)
                                       .build()));

        return CodePipelineActionFactoryResult.builder().runOrdersConsumed(1).build();
    }
}

What did you expect to happen?

cdk synth was successful

What actually happened?

Caused by: software.amazon.jsii.JsiiException: Cannot construct instance of `software.amazon.awscdk.pipelines.ProduceActionOptions` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: UNKNOWN; line: -1, column: -1]

Environment

  • CDK CLI Version : 1.115.0
  • Framework Version:
  • Node.js Version: 16 LTS
  • OS : Linux Mint
  • Language (Version): Java 8

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
deycegcommented, Jul 29, 2021

Hey @deyceg 👋

Thanks for bringing this to our attention.

I’m going to mark this as p1 which means it has been prioritized as important, although please keep in mind that we do have a large number of issues at the moment. It may be some time before we are able to solve this particular issue. We use +1s to help us prioritize our work, and as always we are happy to take contributions if anyone is interested to pick this up and submit a PR.

Hey @ryparker I’d be happy to take a look at it over the weekend.

Reasonably comfortable with both languages though not so much with JSII architecture. The actual exception message is from Jackson.

I’ve located the serialization code here for the Java runtime so maybe a good starting point!

0reactions
github-actions[bot]commented, Aug 13, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pipelines: Configuring the custom step - Bosch IoT Insights
The custom code of your custom step can be either Java 17 or Python 3.9.1. This chapter provides a code example for each...
Read more >
Pipeline design pattern implementation - java - Stack Overflow
This way, all of the specific step knowledge is encapsulated in the Pipeline class. In this case, the execute method can perform a...
Read more >
Building and deploying applications with pipelines - IBM
This guide will walk you through the steps needed to run a pipeline to build your application, publish the image to a registry,...
Read more >
Build a Continuous Deployment Pipeline in Java with Travis CI
In this tutorial you'll start with the basics, learning about CI/CD and the benefits. Then you'll dive into the practical part of the...
Read more >
Build Java apps - Azure Pipelines | Microsoft Learn
Go to Pipelines, and then select New pipeline. Perform the steps of the wizard by first selecting GitHub as the location of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found