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
- Paused project can't activate
I have failed to reactivate one my projects which had been paused
- Site deployment keeps getting failed
Hi good folks, need a hand with Sites deploy Error on every deploy: Synchronous function execution timed out... duration doesn't exceed 30 seconds [exact log ...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...