0

Argument setter - HTTP post endpoint url. Below is the argument setter plugin configuration.

 {
            "name": "Argument Setter",
            "plugin": {
                "name": "ArgumentSetter",
                "type": "action",
                "label": "Argument Setter",
                "artifact": {
                    "name": "argument-setter-plugins",
                    "version": "1.1.1",
                    "scope": "USER"
                },
                "properties": {
                    "method": "POST",
                    "connectTimeout": "60000",
                    "readTimeout": "60000",
                    "numRetries": "0",
                    "followRedirects": "true",
                    "url": "-----url----",
                    "body": "{\"type\": \"DELTA\", \"fileType\": \"CSV\", \"targetName\": \"DATAFUSION_TEST_1\", \"dataPoolId\": \"4d3164d9-c8e4-4042-9c69-ff758a17b140\"}"
                }
            },
            "outputSchema": [
                     {
                    "name": "id",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "targetName",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "lastModified",
                    "type": "int",
                    "nullable" : true
                },
                {
                    "name": "lastPing",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "status",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "type",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "fileType",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "targetSchema",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "upsertStrategy",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "fallbackVarcharLength",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "dataPoolId",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "connectionId",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "postExecutionQuery",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "sanitizedPostExecutionQuery",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "allowDuplicate",
                    "type": "boolean",
                    "nullable" : true
                },
                {
                    "name": "tableSchema",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "mirrorTargetNames",
                    "type": "array",
                    "nullable" : true
                },
                {
                    "name": "changeDate",
                    "type": "int",
                    "nullable" : true
                },
                {
                    "name": "keys",
                    "type": "array",
                    "nullable" : true
                },
                {
                    "name": "logs",
                    "type": "array",
                    "nullable" : true
                },
                {
                    "name": "csvParsingOptions",
                    "type": "string",
                    "nullable" : true
                },
                {
                    "name": "optionalTenantId",
                    "type": "string",
                    "nullable" : true
                }
            ]
        }
    ],

Response from the endpoint url is like below

[{
    "id": "b489dc71-96fd-4e94-bcc5-9a4b3732855e",
    "targetName": "POSTMAN_TBL",
    "lastModified": 1631598169840,
    "lastPing": null,
    "status": "NEW",
    "type": "DELTA",
    "fileType": "PARQUET",
    "targetSchema": null,
    "upsertStrategy": "UPSERT_WITH_UNCHANGED_METADATA",
    "fallbackVarcharLength": null,
    "dataPoolId": "f37b8619-30e2-4804-9355-38d123142ac4",
    "connectionId": null,
    "postExecutionQuery": null,
    "sanitizedPostExecutionQuery": null,
    "allowDuplicate": false,
    "tableSchema": null,
    "changeDate": 1631598169840,
    "mirrorTargetNames": [],
    "keys": [],
    "logs": [],
    "csvParsingOptions": null,
    "optionalTenantId": null
}
 ]

When I execute this, I get 200 response after hitting the endpoint url. But the pipeline is failing with NullPointerException

java.lang.NullPointerException: null
    at io.cdap.plugin.ArgumentSetter.handleResponse(ArgumentSetter.java:73) ~[na:na]
    at io.cdap.plugin.http.HTTPArgumentSetter.run(HTTPArgumentSetter.java:76) ~[na:na]
    at io.cdap.cdap.etl.common.plugin.WrappedAction.lambda$run$1(WrappedAction.java:49) ~[na:na]        

Can someone help me what am I missing here?

aruna j
  • 91
  • 5
  • If I understand, you are using [Description Setter](https://plugins.jenkins.io/description-setter/#documentation)? Could you also provide some process details, what you want to achieve, what have you tried to solve this issue? – PjoterS Sep 14 '21 at 12:33
  • It seems like you're trying to use the argument setter to set an output row when it is actually used to set macro values. From the [documentation](https://github.com/data-integrations/argument-setter/tree/9f6aabbf28e00644726d485188235b406cac522f), the argument setter action plugin can be used to set macros as configured by a remote HTTP server at runtime; thus, the argument setter expects an `arguments` field in the JSON response body of the HTTP response. Since your HTTP response does not include that field, this causes the plugin to throw a null pointer exception. – Dennis Li Sep 20 '21 at 20:47

1 Answers1

0

As mentioned in the comments, the response from the server has to be structured in the following format:

{
    "arguments" : [
        { argument }, { argument }, ..., {argument}
    ]
}

Since your response is not structured in this format, you are getting a NullPointerException when you execute your pipeline.

See docs for reference https://github.com/data-integrations/argument-setter/tree/9f6aabbf28e00644726d485188235b406cac522f#usage