Back

Node SDK Client not connecting in Appwrite 1.6.0

  • 0
  • Self Hosted
  • Functions
kerimovscreations
29 Sep, 2024, 17:12

I had a working function in Appwrite 1.5.7, after migrating to the 1.6.0 it does not work. I have updated node-appwrite dependency to 14.1.0 and here is the code snippet from my function:

TypeScript
import {
  Client,
  Databases,
  Users,
  Query,
  ID
} from "node-appwrite";

class AppwriteService {
  constructor(log) {
    const client = new Client();
    client
      .setEndpoint(process.env.APPWRITE_ENDPOINT)
      .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
      .setKey(process.env.APPWRITE_API_KEY);

      this.users = new Users(client);
      this.databases = new Databases(client);
      this.log = log;
  }

  async getBranchBy(authId) {
    this.log("auth_id: " + authId);
    const result1 = await this.databases.getDocument(
      "player",
      "branches",
      "666ddca400367dcf6a25"
    );
    this.log(result1);
  }

I got an error message like: fetch failed

TL;DR
Developers having issues connecting the Node SDK Client in Appwrite 1.6.0. The solution is to configure function container network settings as an external entity. Upgrading from 1.5.7 to 1.6.0 might cause issues.
kerimovscreations
29 Sep, 2024, 18:47

Fixed by assigning function container network configs as an external entity, not internal

Shariar Khan
29 Sep, 2024, 20:31

I dont get it, im also having same issues

kerimovscreations
9 Oct, 2024, 18:29

Sorry for the late reply. This should be configured in network level, not the appwrite app level. Function containers should be connected to the external network directly.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more