When using the following configuration I’m getting an ECONNRESET on the fetch. I’ve confirmed that my token and accountID are valid as I’m able to make a request with Postman without issue.
const url =
'https://api.cloudflare.com/client/v4/accounts/<account_id>/images/v1'
if (file instanceof File) {
const data = new FormData()
data.append('file', file)
const options: RequestInit = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>'
},
body: data
}
try {
const resp = await fetch(url, options)
const json = await resp.json()
console.log(json)
} catch (error) {
console.log(error)
}
}