Search code examples
javascriptnode.jsreactjsappwrite

Appwrite - Cannot read properties of undefined (reading 'endpoint')


i'm making a project with Appwrite and i have a problem regarding SKD´s. When use a client-side SDK to use the functions of Appwrite Teams it works perfectly, like this:

import { Client, Teams } from "appwrite";
const client = new Client();
client
    .setEndpoint(..some project info..)
    .setProject(....) 
;

const teams = new Teams(client);

const promise = teams.list(); //Works without a problem

But now i'm trying to use a server-side SDK to basically do the same:


const sdk = require('node-appwrite');
const client = new sdk.Client();
client
    .setEndpoint(..same project info..)
    .setProject(...)
    .setKey(...)
;

const teams = new Teams(client);

const promise = teams.list(); //Error

But i get this error: error

am i doing something wrong?


Solution

  • Would you try:

    const teams = new sdk.Teams(client);