'EAI_AGAIN' error while setting the docs example up with a could instance. Javascript, Node

Error stack:

FetchError: request to https://https//bbb-328x3047.weaviate.network/v1/schema failed, reason: getaddrinfo EAI_AGAIN https
at ClientRequest. (/var/www/html/app/node_modules/node-fetch/lib/index.js:1505:11)
at ClientRequest.emit (node:events:513:28)
at TLSSocket.socketErrorListener (node:_http_client:502:9)
at TLSSocket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: ‘system’,
errno: ‘EAI_AGAIN’,
code: ‘EAI_AGAIN’
}

This is the only code I have.

const client = weaviate.client({
scheme: “https”,
host: “https://bbb-328x3047.weaviate.network”,
apiKey: “API KEY”
});

const className = 'Question';
const classObj = {
    class: className,
    vectorizer: 'text2vec-openai',
};

let result = await client.schema.classCreator().withClass(classObj).do();

console.log(JSON.stringify(result, null, 2));

The step generating the error is the let result line. The client variable seems to be holding the db object.

I’m new to weaviate. If anyone has a working example of Javascript code with a connection to the database, adding a schema, and doing a simple search that would be great.

Thanks

Hi! Welcome to our community :hugs:

The issue here is that you are providing the schema together with the hostname.

Try this:

const client = weaviate.client({
scheme: “https”,
host: “bbb-328x3047.weaviate.network”,
apiKey: “API KEY”
});

Let me know if this helps :slight_smile:

Ah, and regarding examples, check out our examples repository: