I have a call in my backend, more or less the same as the code in the API reference as below.
This function in the backend is called every time the event " wixMembers_onMemberUpdated " is triggered. One of the ways that event is triggered is when the member profile is updated in the account Dashboard (say in Contacts > Site Members).
However, when the code is triggered due to an updated member profile event trigger from the dashboard I can see in my logs that the following error is thrown:
“[“listMemberBadges error”,“99013c12-3c73-4b46-86e1-b1ff495da24d”,“Status code: 403, message: {"message":"","details":{}}”]”
However, if I run this code via the editor there is no error.
I am in the Dashboard as a Site Admin, why should this throw a permission error? There is no way to override permissions on this function either.
import { badges } from 'wix-members-backend';
2
3export function myListMemberBadgesFunction() {
4 const memberIds = [
5 "99013c12-3c73-4b46-86e1-b1ff495da24d"
8 ];
9
10 return badges.listMemberBadges(memberIds)
11 .then((memberBadges) => {
12 const firstMemberBadges = memberBadges[0].badgeIds;
13 return memberBadges;
14 })
15 .catch((error) => {
16 console.error("listMemberBadges error", memberIds, error);
17 });
18}