URGENT! onMemberCreated not firing

I created the events.js (using the “Handle backend events” option from the + menu on the backend code section in the editor. Then I created a wixMembers_onMemberCreated function (as shown below) using the example code from the api documentation ( https://www.wix.com/velo/reference/wix-members-backend/events/onmembercreated) . The event handler never fires. I never see the console log output in the Developer Tools>Logs>Site Logs output. I have tested the method using the Run option in the code editor and that works which verifies that the method does not have errors. I have tried this on 2 different sites with no success on either. In all cases the member is created and shows in the Members list in the site dashboard.
I have also tried creating the onMemberDeleted event handler with the same result - the event handler doesn’t fire but the member is deleted.
The members are being created from a custom registration form submission. I deleted the member from the site dashboard.

I have had success with other backend event handlers (for wix_stores) in another site so this is not my first experience working with backend events.

Here is my code:
/**
*
*/
export function wixMembers_onMemberCreated ( event ) {
console . log ( “in backend onMemberCreated event handler” );
//const memberNickname = event.entity.profile.nickname;
//const creationEventId = event.metadata.id;

}

export function wixMembers_onMemberDeleted ( event ) {
//const deletionEventId = event.metadata.id;
console . log ( “in the delete member event handler in the backend” );
}

Please help! What am I missing?

2 Likes

Hi,

I’ve been in the same boat for about 8 days now. Newly created backend event handlers are still not firing for me. I’ve also had success with backend event handlers in the past, but the same working code when copied and pasted to a newly published website just doesn’t work anymore. In fact, I cannot get any newly created backend event handlers to fire. To me, it seems like existing backend event handlers created in the past are still working, but newly created ones are not firing.

I tried to get help in this forum post and on their Discord server, but so far the issue is still unresolved for me.

Hi.
I logged a support ticket for the issue. I hope we both get some answers soon! I will let you know if I hear anything helpful from support. Please let me know if you figure anything out.
Thanks for reaching out.

Also facing the same issue. Have been unable to get backend events to fire for the following APIs:

wix-members-backend
wix-pricing-plans-backend
wix-marketing-backend

Please keep us posted on your progress!

Just heard back from support:
“… When I registered as a member the event was triggered for me…Please note that the event will not be fired until the member has been approved .”
I responded:
" 1. If the event only fires when the member is approved then it should be named onMemberApproved NOT onMemberCreated.
2. Your own api documentation makes no mention of it only firing when the member is approved. In fact that section of the api documentation talks about the status of the member indicating a PENDING status for some members. https://www.wix.com/velo/reference/wix-members-backend/events/onmembercreated .
3. I am trying to write code to run some checks and conditionally approve members. I will do some testing and hope that I can use a combination of onContactCreated, getMember and updateMember to achieve this. I need to examine (in code) a custom field value in deciding whether to approve the member or not. Will this approach work?"

Just wanted to share what I heard since several others seem to be having issues getting the onMemberCreated event to fire.

I will continue to update this post (assuming comments are not turned off) as I learn more and as I try to get my alternate solution to work.

Thanks for the update!

I just did another test. It seems like these newly added event handlers are working for me again after publishing :

wixEvents_onEventCreated
wixEvents_onEventDeleted
wixEvents_onEventUpdated

Hello, I’m going to do a little testing as that information sounds incorrect to me (or the docs need updating)

A member is created regardless of approval and set to a status depending on your approval flow.

Members who require manual approval are created and assigned a pending status as per the docs
“A created member waiting for approval has a status of PENDING”

As far as the hook firing, I would agree that this sounds like either a bug or incorrectly described.

And re: turning comments off - I only do that when folks bump up really old posts with comments that should be new questions to keep the forum threads less confusing, you are fine continuing to talk about the original issue as you work throuhg it.

@lfunk3 I just tested this hook with both approval flows and it is working as expected. The information you received from CS is incorrect and I will follow up internally. Please pass me the ticket number where you received the above response.

This is the code i tested in events.js (copied from docs, added a log)

export function wixMembers_onMemberCreated(event) {
  console.log("member created")
  const memberNickname = event.entity.profile.nickname;
  const creationEventId = event.metadata.id;
}

And here is the log created as expected when the approval is set to MANUAL (not yet approved) or AUTOMATIC

Thanks Amanda. The request number is 1687023876. I thought I posted yesterday to say that it now works for me too but it was NOT working when I created the ticket.
I respect that bugs exist and need to be fixed. When they are, I would appreciate just being notified and not getting a message that says it works - as if it had been my problem all along. I am not talking here about your above comment but about the response I got from support.
Does Wix have any mechanism for notifying developers about outstanding bugs and bug fixes?
Thanks again.

Oh I’m glad it’s working as expected but sorry for the confusion with the support response.

We do not have a generic place that all bugs are viewable publicly. Major outages affecting lost of users are posted via status.wix.com so that is always a great place to check first depending on the issue

Otherwise, reporting through support is the best workflow as they are able to route the issues and collect them all to be able to show the scope and then update when resolved. Coming here to problem solve first is fine as well in case there is a code issue you may have missed (we all have those) but support doesn’t work here in this space as it’s intended for community so they wouldn’t see it.

I hope that is helpful and I will pass your feedback along

hello i have the same problem with onMembersCreated how can i make it run…i want to add some entries in the database after user signeup please do help me? i m new in this Velo verse