memberTagsHandler does not reflect changes from creation of user profile
mschmid opened this issue · 4 comments
I realized a strange behavior.
My memberTags are not synchronized anymore, since I changed how users are created.
I directly create users with setDoc
:
let userProfile = {
language: language,
segments: [segment],
};
const userRef = doc(db, "users", uid);
setDoc(userRef, userProfile, { merge: true });
addUserToList
does not reflect the user profile besides email, and memberTagsHandler.onWrite
somehow does not synchronize the configured attributes language
and segment
.
This is my Firebase Member Tags configuration:
{ "memberTags": ["language", "segments"], "subscriberEmail": "email" }
Subsequent changes to the memberTags fields are reflected to mailchimp correctly.
Just tried again. Now I added member tags in multiple steps/writes to the user profile in my code. These also do not get synchronized by the extension.
One more information: I also changed from firebase v8 to v9 API, which could have an effect.
When changing user profile tags in the Firestore admin console, the changed tag gets synchronized as it should.
Hi @mschmid ,
When you create the userProfile above, are you including the field you've configured as subscriberEmail
?
e.g. if you've set "subscriberEmail": "email"
in your mailchimpMemberTags
, i would expect your code to be:
let userProfile = {
language: language,
segments: [segment],
email: "usersEmailHere@example.com"
};
If you're not sending the email address on the initial creation, you will most likely receive an error like this currently, as it tries to hash an undefined value
TypeError [ERR_INVALID_ARG_TYPE]: The \"data\" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined