import { Client, Account } from "appwrite"; import { ID } from "appwrite";
export function AuthWriter( email, password, name){
try{
const client = new Client();
const account = new Account(client);
console.log("Client and user are initialized")
client.setEndpoint(process.env.APP_WRITER_ENDPOINTT).setProject(process.env.APP_WRITER_PROJECT_ID);
const promise = account.create({userId:ID.unique(),email:email,password:password,name:name});
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
}
catch(error){
console.error(error)
}
} thisis the code
the error
peError: Cannot read properties of undefined (reading 'replace') at Client.setEndpoint (webpack-internal:
Maybe you've extra T here
process.env.APP_WRITER_ENDPOINTT
It seems like the value you've passed to the setEndpoint method is undefined
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Thanks
there seems some error with my env fiel
Is it working now?
yes , works great. the error was due to env file
Thanks alot
[SOLVED] Error with client.setEndpoint
Recommended threads
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...