-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hi @steven-tey,
I've encountered an issue where the dub.track.lead
function is causing a validation error due to a mismatch between the code on the GitHub repository and the version published on NPM.
Error Details:
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"customerExternalId"
],
"message": "Required"
}
Code Comparison:
-
GitHub Repository Version:
await dub.track .lead({ clickId: dubId, eventName: opts.leadEventName || "Sign Up", // This key exists in the GitHub repo customerExternalId: user.id, customerName: user.name, customerEmail: user.email, customerAvatar: user.image, }) .catch((e) => { logger.error(e); });
-
NPM Published Version:
await dub.track.lead({ clickId: dubId, eventName: opts.leadEventName || "Sign Up", // This key is named differently in the NPM version, causing the error externalId: user.id, customerName: user.name, customerEmail: user.email, customerAvatar: user.image }).catch((e) => { logger.error(e); });
The customerExternalId
field is present in the GitHub repository's code, but the NPM package appears to be using externalId
instead, leading to the invalid_type
error as customerExternalId
is undefined
.
Could you please publish an updated version of the package to NPM that includes the changes from the GitHub repository? Implementing a release pipeline would also be beneficial for ensuring consistency between the repository and published packages.
Thank you!
EDIT: Work around while this is not fixed:
dubAnalytics({
dubClient: dub,
customLeadTrack: async (user, ctx) => {
const dubId = ctx?.getCookie("dub_id");
if (!dubId) {
return;
}
await dub.track.lead({
clickId: dubId,
eventName: "Sign Up",
customerExternalId: user.id,
customerName: user.name,
customerEmail: user.email,
customerAvatar: user.image,
});
},
}),