API request sent by Javascript gets 'fetch failed' error

Hi Weaviate,

I am new to both Weaviate and Javascript so I am just following the tutorial here: GraphQL - Get{} | Weaviate - vector database

I have this code in my local machine:

const weaviate = require('weaviate-ts-client');

const client = weaviate.default.client({
  scheme: 'http',
  host: 'http://my-fourth-sandbox.weaviate.network', // my sandbox cluster url
  apiKey: '' // my api key

      .withFields('fieldname') // fieldname
      .then(res => {

but when I run I keep getting this error:

Uncaught TypeError TypeError: fetch failed
    at fetch (internal/deps/undici/undici:11576:11)
    at processTicksAndRejections (internal/process/task_queues:95:5)
No debugger available, can not send 'variables'
Process exited with code 1

Could you help let me know what did I miss during the tutorial? I installed weaviate-ts-client and is running the code using Visual Studio Code.

Thank you in advance

Hi @Phuong_Tran_Soul and welcome! :smiley:

I’m not all that great with TS, but I think that syntax doesn’t look quite right to me. For example, the weaviate.default.client line should be weaviate.client I believe.

I recommend taking a look at the Quickstart (Quickstart Tutorial | Weaviate - vector database) as a starting point and going from there :slight_smile: .