ua-parser-js icon indicating copy to clipboard operation
ua-parser-js copied to clipboard

getResult() retuning normal parsed UA on localhost but empty on Vercel nextjs deployment

Open joneath opened this issue 4 years ago • 0 comments
trafficstars

I'm using the following code in a react component to determine browser version which works wonderfully in dev on localhost but once I deploy the Next.js app to Vercel the entire results object (besides the UA string) is empty.

const uaParser = new UAParser();
const parsedUa = uaParser.getResult();

Localhost getResult()

{
    "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
    "browser": {
        "name": "Chrome",
        "version": "95.0.4638.69",
        "major": "95"
    },
    "engine": {
        "name": "Blink",
        "version": "95.0.4638.69"
    },
    "os": {
        "name": "Mac OS",
        "version": "10.15.7"
    },
    "device": {},
    "cpu": {}
}

Deployed getResult()

{
    "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
    "browser": {},
    "engine": {
        "name": "Blink"
    },
    "os": {
        "name": "Mac OS"
    },
    "device": {},
    "cpu": {}
}

If I copy the source for us-parser-js and paste it into the Chrome's console while running the deployed app I get a full results object from getResults(). Any thoughts on what might be happening here?

joneath avatar Nov 09 '21 22:11 joneath