Receiving ECONNRESET

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)
			}
		}

So I’ve dug into this further and it seems to be only happening at certain file sizes. My code above works fine with a few hundred KB but when I try an image in the MB I get the ECONNRESET. Any ideas on why this might be? I checked the size limitations and I am well under the 10 MB limit.

This topic was automatically closed after 15 days. New replies are no longer allowed.