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
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...