Skip to content

overrides are dropped when the sdk's user agent looks like a server #466

Description

@avionicharshit-byte

parseUserAgent returns the hardcoded server result before it reads overrides, so a client that explicitly sends __os, __model, __brand or __device has all of it discarded whenever its user agent matches the server heuristic.

any non-browser sdk hits this, because a plain name/version user agent is exactly what SINGLE_NAME_VERSION_REGEX matches.

parseUserAgent('my-sdk/1.0.0', { __os: 'Android', __model: 'A105', __brand: 'Acme' })
// { isServer: true, device: 'server', os: '', model: '', brand: '' }

the event then goes down the uaInfo.isServer branch in events.incoming-event.ts, gets an empty deviceId, and is attached to an existing session instead of opening its own. so device, os and brand analytics are empty for every native sdk unless you disguise the user agent as a browser.

i hit this at work, on a self-hosted instance, with a native sdk on android hardware. the workaround was to put Model= and Manufacturer= markers in the user agent so the heuristic stops firing, which the docs do not mention.

happy to send a pr: only take the server shortcut when the caller has not said what the device is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions