Skip to content

TypeError: _a.trim is not a function during exposure event #69

Description

@FabricioFFC

Expected Behavior

The Experiment Node Server SDK should safely handle non-string values when canonicalizing exposure data before calling .trim(). Invalid or unexpected input types should not cause a runtime exception during variant evaluation or exposure tracking.

Current Behavior

A runtime exception is thrown during exposure tracking:

TypeError _a.trim is not a function 
    /app/node_modules/@amplitude/experiment-node-server/dist/src/exposure/exposure.js:16:93 Exposure.canonicalize
    /app/node_modules/@amplitude/experiment-node-server/dist/src/exposure/exposure-filter.js:16:44 InMemoryExposureFilter.shouldTrack
    /app/node_modules/@amplitude/experiment-node-server/dist/src/exposure/exposure-service.js:23:37 AmplitudeExposureService.<anonymous>
    /app/node_modules/@amplitude/experiment-node-server/dist/src/exposure/exposure-service.js:8:71 
    /app/node_modules/@amplitude/experiment-node-server/dist/src/exposure/exposure-service.js:4:12 __awaiter
    /app/node_modules/@amplitude/experiment-node-server/dist/src/exposure/exposure-service.js:22:16 AmplitudeExposureService.track
    /app/node_modules/@amplitude/experiment-node-server/dist/src/local/client.js:149:87 LocalEvaluationClient.evaluateV2
    .next/server/chunks/7651.js:19:1755 d.fetchVariants

Possible Solution

Improve input validation earlier in the exposure pipeline.

Steps to Reproduce

We weren't able to reproduce it locally.

Environment

  • JS Server SDK Version: 1.13.2
  • Runtime: Node.js
  • Installation Method: yarn
  • Browser and Version: N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions