Closed
Description
We are seeing "[Amplitude] TypeError: undefined is not an object (evaluating 't._metadataStorage.save')" errors from Sentry. We also found the _metadataStorage.save
code here:
Amplitude-JavaScript/src/amplitude-client.js
Line 735 in 03c0a89
We are wondering if this is something like a bug in the amplitude client, or are we setting up Amplitude incorrectly?
Environment
{
"node_modules/amplitude-js": {
"version": "8.21.9",
"resolved": "https://registry.npmjs.org/amplitude-js/-/amplitude-js-8.21.9.tgz",
"integrity": "sha512-d0jJH00wbXu7sxKtVwkdSXtVffjqdUrxuACKlnzP7jU5qt9wriXXMgHifdH5Oq+buKmyF8wKL9S02gAykysURA==",
"dependencies": {
"@amplitude/analytics-connector": "^1.4.6",
"@amplitude/ua-parser-js": "0.7.33",
"@amplitude/utils": "^1.10.2",
"@babel/runtime": "^7.21.0",
"blueimp-md5": "^2.19.0",
"query-string": "8.1.0"
}
},
}
How we initialise:
export const Amplitude = () => {
const userId = useUserId()
const amplitudeCookieSessionId = useCookie(AMPLITUDE_SESSION_ID_COOKIE_NAME)
React.useEffect(() => {
if (deviceId) {
amplitude.getInstance().setDeviceId(deviceId)
}
amplitude.getInstance().init(AMPLITUDE_API_KEY, undefined, {
includeUtm: true,
includeReferrer: true,
includeGclid: true,
saveParamsReferrerOncePerSession: true,
unsetParamsReferrerOnNewSession: true,
})
}, [amplitudeCookieDeviceId])
React.useEffect(() => {
amplitude.getInstance().setUserId(userId)
}, [userId])
return null
}
We've been trying to dig around but we have had no leads. Let me know if anything sticks out, happy to help try and debug too.