amplify-js: Can't find Variable: Symbol
Describe the bug Using the library 1.1.27
Expected behavior No error should occur, since this was working fine untill now.
Screenshots

Smartphone (please complete the following information):
- Device: Redmi note 5 pro
- OS: android
Sample code Adding the sample code here https://github.com/Samykills/AwsAmplifyExp
awsAmplify.js `import Amplify, { Analytics } from “aws-amplify”; import Config from “react-native-config”; import { Platform } from “react-native”; import { AppContext } from “react-native-ss-app-core”; class AwsAmplify { static initalize() { const amplifyConfig = { Auth: { identityPoolId: Config.AWS_COGNITO_IDENTITY_POOL_ID, region: “us-east-1” } }; //Initialize Amplify Amplify.configure(amplifyConfig);
const analyticsConfig = {
AWSPinpoint: {
// Amazon Pinpoint App Client ID
appId: Config.AWS_PINPOINT_APP_ID,
// Amazon service region
region: "us-east-1",
mandatorySignIn: false
}
};
Analytics.configure(analyticsConfig);
}
/** *
- @param {String} eventName - name of the event or module - “traffic”
- @param {String} type - Type of event- (“entry”/“exit”) or anything
- @param {String} value - Type of event- can be null or anything */ static recordEvent(eventName, action, title) { let attributesJson = {}; let appContext = AppContext.getAppContext(); attributesJson[“action”] = JSON.stringify(action); attributesJson[“title”] = title; attributesJson[“zoneSelected”] = appContext.parentZoneName; attributesJson[“os”] = Platform.OS; attributesJson[“version”] = Config.CODE_PUSH_VERSION; attributesJson[“eventTimeStamp”] = new Date().getTime().toString(); if (appContext.sessionData) { let sessionData = JSON.parse(appContext.sessionData); attributesJson[“userId”] = sessionData.userId.toString(); sessionData.tenantId ? (attributesJson[“tenantId”] = sessionData.tenantId.toString()) : null; sessionData.tenantDto ? (attributesJson[“tenantname”] = sessionData.tenantDto.name.toString()) : null; }
Analytics.record({
name: eventName,
attributes: attributesJson
});
} }
export default AwsAmplify;` You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app. Adding debug log here :
Can’t find variable: Symbol <unknown> constants.js:19:54 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> API.js:74:18 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:15:12 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:26:12 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> SSAnalytics.js:1 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:1 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> emsLocationComponent.js:14 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:1 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> firebaseNotification.js:6 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:2 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> campusFeedbackServiceManager.js:2 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> campusFeedbackComponent.js:18 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:1 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> app-router.js:19 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.android.js:4 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> App.js:3 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:148:36 _require require.js:132:20 <unknown> index.js:2 loadModuleImplementation require.js:214:12 guardedLoadModule require.js:141:45 _require require.js:132:20 global code
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 17 (3 by maintainers)
Commits related to this issue
- fix(@aws-amplify/core): guard for Symbol reference * Some JS interpreters don't native support `Symbol` yet. An example is the version of JavaScriptCore that ships with React Native 0.58 on Andro... — committed to jessedoyle/amplify-js by deleted user 5 years ago
- fix(@aws-amplify/core): guard for Symbol reference * Some JS interpreters don't native support `Symbol` yet. An example is the version of JavaScriptCore that ships with React Native 0.58 on Andro... — committed to jessedoyle/amplify-js by deleted user 5 years ago
- fix(@aws-amplify/core): guard for Symbol reference * Some JS interpreters don't native support `Symbol` yet. An example is the version of JavaScriptCore that ships with React Native 0.58 on Andro... — committed to jessedoyle/amplify-js by deleted user 5 years ago
- Merge pull request #3286 from jessedoyle/gh-3233 fix(@aws-amplify/core): guard for Symbol reference — committed to aws-amplify/amplify-js by sammartinez 5 years ago
- fix(@aws-amplify/core): guard for Symbol reference * Some JS interpreters don't native support `Symbol` yet. An example is the version of JavaScriptCore that ships with React Native 0.58 on Andro... — committed to computationalcore/amplify-js by deleted user 5 years ago
To those who are still facing this issue
To resolve this followed following post https://github.com/facebook/react-native/issues/15786#issuecomment-404834632
basically this issue occurred since JavaScriptCore might be not updated on your device or emulator your best bet will be to try jsc-android-buildscripts to provide this compatibility below is the instruction to integrate same on Android
https://github.com/react-native-community/jsc-android-buildscripts#how-to-use-it-with-my-react-native-app