amplitude / Amplitude-Node

Server-side Node.js SDK for Amplitude
MIT License
67 stars 20 forks source link

Not including OS in Node library payload overrides user properties from client library payload with empty string #72

Closed JayAtCricket closed 3 years ago

JayAtCricket commented 3 years ago

Expected Behavior

If a user has an OS user property set from an event logged via the client-side library, then a subsequent event from the node library that omits user attributes in the payload should not override attributes with empty strings, namely the os_name attribute.

Current Behavior

Starting with a client event we get:

image

and after sending the node event we get an empty string that overrides the User's OS attribute:

image

Possible Solution

Somewhere in the API2 service the absence of an os_name in the payload is being interpreted as an empty string and that should be resolved.

Steps to Reproduce

Please see here for a simple React application demonstrating this bug.

  1. Update the src/App.js file with an appropriate Amplitude Project API key
  2. Start the dev server with yarn start
  3. Visit the app
  4. Click the log event with client-side SDK button to see an event show up in the project with the user's OS information appropriately shown in the user properties in the event as well as of the User itself
  5. Click the log event with node SDK button to see an event show up in the project with an empty string for the OS and see that it also overrides the User's overall OS to an empty string.

Environment

kelvin-lu commented 3 years ago

Hey @JayAtCricket !

First off, thanks so much for creating an application and creating an example - this will be super helpful for our data team. I'll go ahead and continue this investigation with our internal team to see if the possible soln you provided matches up with the root cause and follow up here. Let us know if you find other issues with event ingestion!

tommedema commented 3 years ago

For us the OS is set to an empty string even when specifying os_name

ajhorst commented 3 years ago

fixed with v1.5.2, which is now available