-
Notifications
You must be signed in to change notification settings - Fork 155
Closed
Description
Description
I've been following the Segment docs to send page and track events using the @segment/analytics-node package in my Node.js API.
However, when I call analytics.page as documented:
analytics.page({
userId,
properties,
});I get the following validation error:
Error: .userId/anonymousId/previousId/groupId is nilUpon inspecting the event object passed to assertUserIdentity(event), I noticed that userId is missing:
{
"timestamp": "2025-03-21T15:01:38.730Z",
"integrations": {},
"type": "page",
"properties": {},
"context": {},
"messageId": "node-next-...."
}Interestingly, if I pass userId as the first argument:
analytics.page(userId, {
userId,
properties,
});It bypasses the validation error but then causes issues elsewhere.
Question
Is this the expected behaviour? Am I structuring the call incorrectly, or is there a known issue with how userId is handled? Any guidance would be appreciated!
Metadata
Metadata
Assignees
Labels
No labels