Skip to content

[CRITICAL] The plugin is actually unusable as npm code is not reflecting the actual repository code #5

@Velka-DEV

Description

@Velka-DEV

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,
    });
  },
}),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions