Skip to main content

This has got to be something simple, but I can’t figure out what it is. I’m successfully tracking events with the browser SDK. I’m now trying to bounce certain events to my Node.js server and I’m getting the error “Request missing required field”. 

This is a console log of the error in the response from the `track` function:

result {
event: {
time: 1723243786017,
insert_id: 'beba5469-9fad-4e38-a9f9-b24de353cead',
plan: undefined,
event_type: 'Change Selected Legal Entity',
event_properties: {
user_id: '8d024873-5018-46c3-9520-9b288d0cc5b7',
device_id: '68f3b49c-6854-47a9-bed2-5011470376b0',
screenResolution: '2560x1440',
appVersion: '0.0.0',
isInternalUser: true
},
event_id: 0,
library: 'amplitude-node-ts/1.3.6'
},
code: 400,
message: 'Request missing required field'
}

 

My call to `track` seems correct given the docs:

track(data.event, eventProperties)

Event properties is a `Record` type with the properties you see in the error response. I also tried a regular JS object. I tried `user_id` and `device_id` as well as `userId` and `deviceId` since the camel case version is used in the browser SDK. Finally, `data.event` is the string “Change Selected Legal Entity”. 

What required field am I missing?

I figured it out. Unlike the browser SDK, the `user_id` and `device_id` need to be passed with the third argument to `track`. The documentation does show this with `user_id` in one of the examples.


Reply