Error: "stream does not start with a json array" when making logpush job, incorrect error code?

I am trying to make a logpush job that sends an array JSON to axiom. I am getting an error:
{"errors":[{"code":1002,"message":"error validating destination: error writing object: error uploading to https: 400 {\"message\":\"stream does not start with a json array\"}"}],"messages":[],"result":null,"success":false}
{"errors":[{"code":1002,"message":"error validating destination: error writing object: error uploading to https: 400 {\"message\":\"stream does not start with a json array\"}"}],"messages":[],"result":null,"success":false}
looking up code 1002 I see that would mean Error 1002: DNS points to Prohibited IP according to https://support.cloudflare.com/hc/en-us/articles/360029779472-Troubleshooting-Cloudflare-1XXX-errors. Is this the case or should I go with the error message? My request looks like this:
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logpush/jobs' \
-H 'X-Auth-Key: <API_KEY>' \
-H 'X-Auth-Email: <EMAIL>' \
-H 'Content-Type: application/json' \
-d '{
"name": "workers-logpush",
"output_options": {
"field_names": ["ClientIP", "EdgeStartTimestamp", "RayID", "Event", "EventTimestampMs", "Outcome", "Exceptions", "Logs", "ScriptName"],
"sample_rate": 1.0,
"timestamp_format": "rfc3339",
"output_type": "ndjson",
"batch_prefix": "[",
"batch_suffix": "]",
"record_prefix": "{",
"record_suffix": "}",
"record_delimiter": ","
},
"destination_conf": "https://cloud.axiom.co/api/v1/datasets/$DATASET_NAME/ingest?header_Authorization=Bearer%20$BEARER_TOKEN&header_content-type=application%2Fjson",
"dataset": "workers_trace_events",
"enabled": true
}'
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logpush/jobs' \
-H 'X-Auth-Key: <API_KEY>' \
-H 'X-Auth-Email: <EMAIL>' \
-H 'Content-Type: application/json' \
-d '{
"name": "workers-logpush",
"output_options": {
"field_names": ["ClientIP", "EdgeStartTimestamp", "RayID", "Event", "EventTimestampMs", "Outcome", "Exceptions", "Logs", "ScriptName"],
"sample_rate": 1.0,
"timestamp_format": "rfc3339",
"output_type": "ndjson",
"batch_prefix": "[",
"batch_suffix": "]",
"record_prefix": "{",
"record_suffix": "}",
"record_delimiter": ","
},
"destination_conf": "https://cloud.axiom.co/api/v1/datasets/$DATASET_NAME/ingest?header_Authorization=Bearer%20$BEARER_TOKEN&header_content-type=application%2Fjson",
"dataset": "workers_trace_events",
"enabled": true
}'
It seems like maybe that error message is a middle server not interpreting the body correctly and forwarding it, and maybe the code is actually correct?
3 Replies
DanTheGoodman
DanTheGoodmanOP2y ago
I tried pointing it to webhook.site... why would it send test
DanTheGoodman
DanTheGoodmanOP2y ago
DanTheGoodman
DanTheGoodmanOP2y ago
is there a way I can prevent it from doing this test request? That's super strange that it would send that... so it seems the error is coming from axios because it's sending not actually JSON... and that the error code coming back is also incorrect (1002) Also seems there is no way to disable this test request, at least according to the docs
Want results from more Discord servers?
Add your server