Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-9537

Abstract transformations in configurations cause unfriendly error message.

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.4.0
    • 2.6.0, 2.4.2, 2.5.1
    • connect
    • None

    Description

      I was working with a coworker who had a bash script posting a config to connect with

      org.apache.kafka.connect.transforms.ExtractField.$Key

      in the script. Bash removed the $Key because it wasn't escaped properly.

      org.apache.kafka.connect.transforms.ExtractField.

      is made it to the rest interface. A Class<?> was create for the abstract implementation of ExtractField and passed to getConfigDefFromTransformation. It tried to call newInstance which threw an exception. The following gets returned via the rest interface.

      {
        "error_code": 400,
        "message": "Connector configuration is invalid and contains the following 1 error(s):\nInvalid value class org.apache.kafka.connect.transforms.ExtractField for configuration transforms.extractString.type: Error getting config definition from Transformation: null\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
      }
      

      It would be a much better user experience if we returned something like

      {
        "error_code": 400,
        "message": "Connector configuration is invalid and contains the following 1 error(s):\nInvalid value class org.apache.kafka.connect.transforms.ExtractField for configuration transforms.extractString.type: Error getting config definition from Transformation: Transformation is abstract and cannot be created.\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
      }
      

      or

      {
        "error_code": 400,
        "message": "Connector configuration is invalid and contains the following 1 error(s):\nInvalid value class org.apache.kafka.connect.transforms.ExtractField for configuration transforms.extractString.type: Error getting config definition from Transformation: Transformation is abstract and cannot be created. Did you mean ExtractField$Key, ExtractField$Value?\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
      }
      

      Attachments

        Issue Links

          Activity

            rhauch Randall Hauch added a comment -

            Merged to `trunk` for inclusion in 2.6.0, and cherry-picked to `2.5` (for future 2.5.1 release) and `2.4` (for future 2.4.2 release).

            rhauch Randall Hauch added a comment - Merged to `trunk` for inclusion in 2.6.0, and cherry-picked to `2.5` (for future 2.5.1 release) and `2.4` (for future 2.4.2 release).
            githubbot ASF GitHub Bot added a comment -

            jcustenborder commented on pull request #8090: KAFKA-9537 - Cleanup error messages for abstract transformations
            URL: https://github.com/apache/kafka/pull/8090

            Added check if the transformation is abstract. If so throw an error message with guidance for the user.

            *More detailed description of your change,
            if necessary. The PR title and PR message become
            the squashed commit message, so use a separate
            comment to ping reviewers.*

            *Summary of testing strategy (including rationale)
            for the feature or bug fix. Unit and/or integration
            tests are expected for any behaviour change and
            system tests should be considered for larger changes.*

                1. Committer Checklist (excluded from commit message)
            • [ ] Verify design and implementation
            • [ ] Verify test coverage and CI build status
            • [ ] Verify documentation (including upgrade notes)

            ----------------------------------------------------------------
            This is an automated message from the Apache Git Service.
            To respond to the message, please log on to GitHub and use the
            URL above to go to the specific comment.

            For queries about this service, please contact Infrastructure at:
            users@infra.apache.org

            githubbot ASF GitHub Bot added a comment - jcustenborder commented on pull request #8090: KAFKA-9537 - Cleanup error messages for abstract transformations URL: https://github.com/apache/kafka/pull/8090 Added check if the transformation is abstract. If so throw an error message with guidance for the user. *More detailed description of your change, if necessary. The PR title and PR message become the squashed commit message, so use a separate comment to ping reviewers.* *Summary of testing strategy (including rationale) for the feature or bug fix. Unit and/or integration tests are expected for any behaviour change and system tests should be considered for larger changes.* Committer Checklist (excluded from commit message) [ ] Verify design and implementation [ ] Verify test coverage and CI build status [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org

            People

              jcustenborder Jeremy Custenborder
              jcustenborder Jeremy Custenborder
              Randall Hauch Randall Hauch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: