Hello Appwrite Team,
I'm experiencing a "SERVER ERROR" whenever I attempt to send push notifications using the Messaging API. The function fails without clear details on what might be wrong.
Here’s the exact code I’m using:
ID.unique(), // messageId
'Don\'t Miss Your Prayer Partner!', // title
'You have 24 hours to open the app or you will be set to inactive.', // body
[], // topics (optional)
[user.$id], // users (optional)
[], // targets (optional)
{
fromName: 'Nosakhare',
messageType: 'TEXT',
message: 'You have 24 hours to open the app or you will be set to inactive',
fromUserId: '0'
}, // data (optional)
'open_app', // action (optional)
null, // image (optional)
'default_icon', // icon (optional)
'default', // sound (optional)
'#6E0FAD', // color (optional)
'inactivity_alert', // tag (optional)
1, // badge (optional)
false, // draft (optional)
null // scheduledAt (optional)
);```
Everything seems correct based on the documentation, yet the API consistently returns a server error. Could you please check if this is an issue on Appwrite’s end or let me know if any modifications are required?
i added the below code for more info about the issues
log(`Detailed error for user ${user.$id}: ${JSON.stringify(error)}`);
log(`Error stack: ${error.stack}`);
log(`Failed to process user ${user.$id}: ${error.message}`);```
**so, here is the output of the log**
Failed to process user 2349034286339: Server Error Detailed error for user 2349034286339: {"name":"AppwriteException","code":500,"type":"general_unknown","response":{"message":"Server Error","code":500,"type":"general_unknown","version":"1.6.1"}} Error stack: AppwriteException: Server Error at _Client.call (file:///usr/local/server/src/function/node_modules/node-appwrite/dist/client.mjs:274:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Messaging.createPush (file:///usr/local/server/src/function/node_modules/node-appwrite/dist/services/messaging.mjs:276:12) at async processBatch (file:///usr/local/server/src/function/src/main.js:101:28) at async processNextChunk (file:///usr/local/server/src/function/src/main.js:40:7) at async Module.default (file:///usr/local/server/src/function/src/main.js:53:20) at async execute (/usr/local/server/src/server.js:208:16) at async action (/usr/local/server/src/server.js:225:7) at async /usr/local/server/src/server.js:14:5```
if you are having issues like this, its a result of the structure of the Messaging api, below is what works for me
try {
await messaging.createPush(
ID.unique(),
'Don\'t Miss Your Prayer Partner!',
'You have 24 hours to open the app or you will be set to inactive.',
[],
[user.$id],
[],
{
fromName: 'Nosakhare',
messageType: 'TEXT',
message: 'You have 24 hours to open the app or you will be set to inactive',
fromUserId: '0'
},
'open_app'
);
} catch (error) {
log(`Detailed error for user ${user.$id}: ${JSON.stringify(error)}`);
// log(`Error stack: ${error.stack}`);
}
[SOLVED] Messaging API Failing with "SERVER ERROR"
Recommended threads
- Cloud Function Execution Limit Issue on ...
Hello Appwrite Team, I’m experiencing a critical issue with the cloud console. According to the pricing details on the official Appwrite website, the Pro Plan...
- Websocket Message too long for my ESP826...
- Is function creation completely blocked ...
Gives the error message as given in the image when trying to create a function with GUI Also trying it from latest CLI gives the following error ``` ➜ video...