Commit b15f2a2b authored by lynn's avatar lynn Committed by GitHub

feat: fail gracefully when amplitude api key is not present (#4355)

init
parent 3cc0a41e
......@@ -12,7 +12,8 @@ export function initializeAnalytics() {
if (typeof API_KEY === 'undefined') {
const keyName = isProductionEnv() ? 'REACT_APP_AMPLITUDE_KEY' : 'REACT_APP_AMPLITUDE_TEST_KEY'
throw new Error(`${keyName} must be a defined environment variable`)
console.error(`${keyName} is undefined, Amplitude analytics will not run.`)
return
}
init(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment