turbot / flowpipe

Flowpipe is a cloud scripting engine. Automation and workflow to connect your clouds to the people, systems and data that matters.
https://flowpipe.io
GNU Affero General Public License v3.0
361 stars 13 forks source link

Getting error `Error unmarshalling response body` for `No content` response #377

Closed karanpopat closed 10 months ago

karanpopat commented 10 months ago

Getting error 2023-12-04T11:41:40.619+0530 ERROR Error unmarshalling response body {"error": "unexpected end of JSON input"} when there is no actual response expected from the POST HTTP call. The pipeline run succeeds with an error message for unmarshalling the response body. Haven't observed similar errors in other pipelines that have 204 responses.

➜  flowpipe-mod-vault git:(initial-pipelines) ✗ flowpipe pipeline run create_secret --arg path='my_path/hello' --arg secret='{"key1":"value1","key2":"value2"}'
[Execution] exec_clmmr70sfi0incknnmn0
2023-12-04T11:41:40.619+0530    ERROR   Error unmarshalling response body       {"error": "unexpected end of JSON input"}
[create_secret] Starting: pexec_clmmr70sfi0incknnmng
[create_secret.create_secret] Starting http step
[create_secret.create_secret] Arg method = post
[create_secret.create_secret] Arg request_body = {"key1":"value1","key2":"value2"}
[create_secret.create_secret] Arg request_headers = {
  "X-Vault-Token": "Token"
}
[create_secret.create_secret] Arg step_name = create_secret
[create_secret.create_secret] Arg url = http://127.0.0.1:8200/v1/secret/my_path/hello
[create_secret.create_secret] Complete 19ms
[create_secret] Complete 32ms

curl output

➜  flowpipe-mod-vault git:(initial-pipelines) ✗ curl -v --header "X-Vault-Token: $VAULT_TOKEN"\   
  --data '{"key1": "value1", "key2": "value2"}' \
  http://localhost:8200/v1/secret/my-secret
*   Trying 127.0.0.1:8200...
* Connected to localhost (127.0.0.1) port 8200 (#0)
> POST /v1/secret/my-secret HTTP/1.1
> Host: localhost:8200
> User-Agent: curl/7.84.0
> Accept: */*
> X-Vault-Token: Token
> Content-Length: 36
> Content-Type: application/x-www-form-urlencoded
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Cache-Control: no-store
< Content-Type: application/json
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Date: Mon, 04 Dec 2023 06:27:44 GMT
< 
* Connection #0 to host localhost left intact
karanpopat commented 10 months ago

output.json

{
  "args": {
    "path": "my_path",
    "secret": {
      "key1": "value1",
      "key2": "value2"
    }
  },
  "http.create_secret": [
    {
      "status": "finished",
      "data": {
        "finished_at": "2023-12-04T06:08:31.204909Z",
        "response_body": "",
        "response_headers": {
          "Cache-Control": "no-store",
          "Content-Type": "application/json",
          "Date": "Mon, 04 Dec 2023 06:08:31 GMT",
          "Strict-Transport-Security": "max-age=31536000; includeSubDomains"
        },
        "started_at": "2023-12-04T06:08:31.141864Z",
        "status": "204 No Content",
        "status_code": 204
      }
    }
  ]
}