I use expo go and expo 48 on the frontend and firebase admin sdk on the backend. using cloud functions I push notifications like
When I send the body, everything works fine but when I try to send the data object nothing happens. I sometimes don't receive the notification at all or sometimes it comes and the data object is null. I use "expo-notifications": "0.18.1" like this
Everything was working before just fine and there was no issue and then all of a sudden I had this issue. I'm having this issue going on for 5 days now. thanks in advance.
Edit
Here is the code for both images
import axios from "axios";
export default async function sendPushNotification(expoPushToken, title, data) {
try {
const message = {
to: expoPushToken,
sound: "default",
title: title,
data: data,
};
await axios.post("https://exp.host/--/api/v2/push/send", message, {
headers: {
Accept: "application/json",
"Accept-encoding": "gzip, deflate",
"Content-Type": "application/json",
},
});
} catch (error) {
console.error("Error sending notification:", error.message);
}
}
and
useEffect(() => {
notificationListener.current = Notifications.addNotificationReceivedListener(async (notification) => {
const body = notification.request.content.body;
const data = notification.request.content.data;
console.log(body);
console.log(data);
});
return () => {
Notifications.removeNotificationSubscription(notificationListener.current);
};
}, []);


Everything seems back to normal. since I'm using firenase emulators with "https://exp.host/--/api/v2/push/send", I might have hit the expo notifications free tier limit for the month and that the number of notifications I can send reset to 0