stocky-vr-69425
09/22/2023, 12:23 AManalytics.Track.UserId: invalid field value: "" error from the RudderStack Go SDK v4. The documentation at https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-go-sdk/#track says that for the Track event, userId is required if anonymousId is absent, and vice versa, but it also says that the SDK automatically sets anonymousId "where there is no unique identifier for the user" (I assume this means the userId?). So we don't understand this error message. If userId is "", then shouldn't the SDK be setting anonymousId for us?millions-activity-52391
09/22/2023, 12:23 AMhigh-zoo-17436
09/22/2023, 5:03 AMstocky-vr-69425
09/22/2023, 5:12 AMhigh-zoo-17436
09/22/2023, 5:14 AMhigh-zoo-17436
09/22/2023, 5:45 AMmillions-activity-52391
09/22/2023, 12:38 PMstocky-vr-69425
09/23/2023, 1:30 AMstocky-vr-69425
09/23/2023, 1:33 AMrs := analytics.New(...)
defer func() {
if err := rs.Close(); err != nil {
log.Printf("cannot close rudderstack client: %v", err)
}
}()
var userID string
if user := ...; user != nil {
userID = strconv.Itoa(user.ID)
}
track := analytics.Track{
UserId: userID,
Event: "...",
Properties: analytics.Properties{
...
},
}
if err := rs.Enqueue(track); err != nil {
log.Printf("cannot send rudderstack event %#v: %v", track, err)
}stocky-vr-69425
09/23/2023, 1:34 AMstocky-vr-69425
09/23/2023, 1:35 AMhigh-zoo-17436
09/25/2023, 3:56 AM