ZionniteOriginal post
Rank 4: Virtual Machine
Hello appwriter & team
i'm trying to subscribe my already existing users to a topic but its not working, it just get stuck at a place
Plain text
// This is your Appwrite function// It's executed each time we get a requestexport default async ({ req, res, log, error }) => { const client = new Client(); client.setEndpoint(process.env.MY_APPWRITE_ENDPOINT).setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID).setKey(process.env.APPWRITE_API_KEY); const functions = new Functions(client); const database = new Databases(client); const storage = new Storage(client); const users = new Users(client);
const ENDPOINT = process.env.MY_APPWRITE_ENDPOINT; const PROJECT_ID = process.env.APPWRITE_FUNCTION_PROJECT_ID; const API_KEY = process.env.APPWRITE_API_KEY; const DATABASE_ID = process.env.DATABASE_ID; const USERS_ID = process.env.USERS_ID; const SMS_PROVIDER_ID = process.env.SMS_PROVIDER_ID; const EMAIL_PROVIDER_ID = process.env.EMAIL_PROVIDER_ID; const PUSH_PROVIDER_ID = process.env.PUSH_PROVIDER_ID;
const GENERAL_TOPIC_ALL = process.env.GENERAL_TOPIC_ALL; const GENERAL_TOPIC_SMS = process.env.GENERAL_TOPIC_SMS; const GENERAL_TOPIC_PUSH = process.env.GENERAL_TOPIC_PUSH; const GENERAL_TOPIC_EMAIL = process.env.GENERAL_TOPIC_EMAIL;
const data = JSON.parse(req.bodyRaw); const subscribeType = data.type;
try{Summary
Developers are experiencing issues with the createSubscriber endpoint in the Appwrite Cloud Function. The code appears to be getting stuck at a certain point. The issue might be due to handling multiple subscriber creations. They should check the logical flow for each subscribeType and refine the code accordingly, ensuring each messaging.createSubscriber call happens properly. It's also recommended to confirm the functionality with a simpler test scenario.