Seeing `fetch failed` from Node.js (read ECONNRESET)

Today I started to see fetch failed from the ECONNRESET read exception when using (native) fetch in Node.js v18 and v20. Without changes on my end. Tried to re-install dependencies, upgrade to the latest versions of Node.js, reboot macOS, etc. to no avail.

The same error also occurs in Node.js v16 when using a fetch polyfill which uses the native https.request method under the hood.

Requests keep failing consistently. Trying the /query and /vectors/delete endpoints.

The controller endpoint (https://controller.${environment}.pinecone.io/databases) works fine.

Making the same requests to the same url’s from browser or with curl work fine.

I’m on the free plan.

Example code (using the same code in the browser works fine):

const response = await fetch(`https://[redacted].svc.[redacted].pinecone.io/query`, {
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    'Api-Key': token
  },
  method: 'POST',
  body: JSON.stringify({ ...defaults, vector, namespace })
});

Curious as to why this could happen. If anybody has a clue I’m all ears!

Shoot! Appears I was using the wrong base url all along today (somehow copy-pasted over an existing item in a .env file).

Totally an issue on my end obviously.

Perhaps still good to see how the response could be improved on? This could help people to identify the issue when having typos in the url or something. Guess it should be a 403 or 404.