
require("dotenv").config(); /**
- @author David Derrick Anyuru davidderrickanyuru@gmail.com
- @file appwrite.js
- @module appwrite
- @requires dotenv
- @requires node-appwrite
- @requires node-appwrite.ID
- @requires node-appwrite.Databases
- @requires node-appwrite.Users
- @requires node-appwrite.Teams
- @requires node-appwrite.Client
- @description Setup your appwrite server
- @see https://appwrite.io/docs/server
- @see https://appwrite.io/docs/server/account
- @see https://appwrite.io/docs/server/databases
- @see https://appwrite.io/docs/server/teams
- @see https://appwrite.io/docs/server/storage */ const ID = require("node-appwrite").ID; const Databases = require("node-appwrite").Databases; const Users = require("node-appwrite").Users; const Teams = require("node-appwrite").Teams; const Client = require("node-appwrite").Client;

ah wait. are you using the server sdk?

You're code isn't good, check here : https://appwrite.io/docs/server/databases?sdk=nodejs-default#databasesCreate

Yes I am using the server SDK to create the initial project configuration. Create collections and dummy users, and collections for my opensource project

So that's what they run when they've just cloned the project

Have you set the environment variables for the function?

Yes.

Can you show? Just to be sure.

Feel free to hide any important variables

API_KEY=your-api-key PROJECT_ID=your-project-id PROJECT_ENDPOINT=your-project-endpoint REDIRECT_URL=your-redirect-url

They appear in that format

I suppose you try to fork this repo : https://github.com/davidofug/distributa ?

That's the project I'm contributing to

PROJECT_ENDPOINT=your-project-endpoint
Here you need
PROJECT_ENDPOINT=https://cloud.appwrite.io/v1
If you use cloud, or own appwrite instance URL

Do you know that's it's always the best practice not to expose environment variables.

I've already set these in my local environment

And I'm not ready to expose them here

Error msg on your screenshot suggest that you set api.appwrite.io

Alright let me try to debug

I can access the environment variables

I've confirmed

After some hefty debugging. I've finally figured it out. Thanks for your help.

Could you please explain what the issue was?
It'll come in handy to other people who might fave a similar issue!

The code had no errors. I just started another project

In the cloud. But still doesn't work with the old project variables
Recommended threads
- SSR Image Previews
I am using the SSR guide (with SvelteKit) to use Appwrite on both the server and the client. I do this by also passing the cookie back to the client and creatin...
- general_route_not_found
{"message":"Route not found. Please ensure the endpoint is configured correctly and that the API route is valid for this SDK version. Refer to the API docs for ...
- Multiple Set-Cookie headers collapsed on...
I’m deploying a Next.js 15 app to Appwrite → Deploy → Sites. In app/api/auth/login/route.ts I try to set 3 cookies. Variant A (manual headers): const headers ...
