processors section = Unable to parse payload: json: cannot unmarshal bool into Go struct field Job.processors of type string.
immortel32 opened this issue · 4 comments
Describe the bug
This is done with a Docker image, I tried multiple 3.x versions
Based on the documentation, I can create a job with this:
http://localhost:9960/v1/jobs
{ "name": "job1", "schedule": "@every 10s", "timezone": "EST", "owner": "Platform Team", "owner_email": "platform@example.com", "disabled": false, "tags": { "server": "true:1" }, "metadata": { "user": "root" }, "processors": { "files": { "forward": true } }, "concurrency": "allow", "executor": "shell", "executor_config": { "command": "date" } }
It works fine if I remove the parent_job and processors section. If I keep the processors section, I get the following error message:
`HTTP/1.1 400 Bad Request
Date: Thu, 01 Feb 2024 17:03:31 GMT
Content-Length: 104
Content-Type: text/plain; charset=utf-8
Unable to parse payload: json: cannot unmarshal bool into Go struct field Job.processors of type string.`
To Reproduce
see Description
Expected behavior
I believe that the documentation is not up to date and I don't find any other source of documentation that could help me.
Screenshots
** Specifications:**
- OS: docker image
- Version: 3.2.7, 3.2.6, v3.1.10
Additional context
N/A
Can you try importing the json using /v1/restore --form 'file=@backup.json'
?
Can you try importing the json using
/v1/restore --form 'file=@backup.json'
?
I tried but I did not get any response. I created a file called forward_to_file.json:
{ "name": "job1", "schedule": "@every 10s", "timezone": "EST", "owner": "Platform Team", "owner_email": "platform@example.com", "disabled": false, "tags": { "server": "true:1" }, "metadata": { "user": "root" }, "processors": { "files": { "forward": true } }, "concurrency": "allow", "executor": "shell", "executor_config": { "command": "date" } }
Then I did the command in curl:
curl -X POST -H "Content-Type: application/json" http://localhost:9960/v1/restore --form 'file=@forward_to_file.json'
I did not have any return anything and the job does not appear in the UI.
Ok, I found the error.
There is an error in the documentation.
https://dkron.io/api/#tag/jobs/operation/getJobs, it indicates that for the files processor:
"processors": { "files": { "forward": true } },
But the real answer is in the processor information page ; https://dkron.io/docs/usage/processors/file
Where the true must be a string:
"processors": { "files": { "forward": "true" } }
I tried it and it worked.