aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

Can't find variable: self #8733

Closed karthinidc closed 3 years ago

karthinidc commented 3 years ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

GraphQL API

Amplify Categories

auth

Environment information

"aws-amplify": "^4.2.2", "aws-amplify-react-native": "5.0.3", ![Uploading Simulator Screen Shot - iPad Air (3rd generation) - 2021-08-10 at 11.19.24.png…]()

Describe the bug

I tried the latest version of the aws-amplify - After import, this aws-amplify only getting the error.

In the release mode the App gets crashes. Our React Native version -
"react": "16.8.3", "react-native": "0.59.9",

Expected behavior

No error should shows

Reproduction steps

Install - "aws-amplify": "^4.2.2", "aws-amplify-react-native": "5.0.3", "react": "16.8.3", "react-native": "0.59.9",

Code Snippet

import appSyncConfig from '../src/aws-exports'; import Amplify from 'aws-amplify';

Amplify.Logger.LOG_LEVEL = 'DEBUG'; Amplify.configure(appSyncConfig);

Log output

``` // Put your logs below this line ```

aws-exports.js

const awsmobile = { "aws_project_region": "us-west-2", "aws_cognito_identity_pool_id": "XXXXXXXX", "aws_cognito_region": "us-west-2", "aws_user_pools_id": "XXXXXXXX", "aws_user_pools_web_client_id": "XXXXXXXX", "oauth": {}, "aws_appsync_graphqlEndpoint": "XXXXXXXX", "aws_appsync_region": "us-west-2", "aws_appsync_authenticationType": "AWS_IAM" };

Manual configuration

No response

Additional configuration

No response

Mobile Device

iPad air 3rd Gen

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

chrisbonifacio commented 3 years ago

Hey @karthinidc 👋 are you using the React Native CLI or Expo to create your project?

karthinidc commented 3 years ago

@chrisbonifacio - Using React Native CLI to create the project. In the release mode, the App gets crashes.

chrisbonifacio commented 3 years ago

@karthinidc It looks like you tried to share a screenshot of the error but the link is broken in the description. Need more information to try to reproduce this issue.

Also, by release mode do you mean it's crashing only on a physical device? Does it only seem to work in the simulator?

I've never seen this error before when it comes to any of the Amplify libraries. It might be related to this?

https://stackoverflow.com/questions/52269560/react-native-expo-cant-find-variable-self

If you can post the contents of your package.json that might help since the above has to do with Expo but you said you used the RN CLI so maybe the issue has to do with some other dependency.

karthinidc commented 3 years ago

@chrisbonifacio
Simulator Screen Shot - iPad Air (3rd generation) - 2021-08-16 at 09 22 54

It occurs in simulators like screenshots and crashes on a physical device.

package.json

{ "name": "XXXXXX", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-async-storage/async-storage": "1.13.2", "@react-native-community/async-storage": "1.6.1", "@react-native-community/netinfo": "3.2.1", "@react-native-community/push-notification-ios": "1.8.0", "appcenter": "2.5.0", "appcenter-analytics": "2.5.0", "appcenter-crashes": "2.5.0", "awesome-react-native-video-controls": "1.0.7", "aws-amplify": "^4.2.3", "axios": "0.18.0", "backbone-events-standalone": "0.2.7", "buffer": "6.0.3", "compare-versions": "3.6.0", "dateformat": "3.0.3", "email-validator": "2.0.3", "graphql-tag": "2.6.1", "lodash": "4.17.15", "moment": "2.22.1", "react": "16.8.3", "react-native": "0.59.9", "react-native-animatable": "1.2.4", "react-native-appstore-version-checker": "3.0.0", "react-native-autosuggest": "1.0.1", "react-native-bcrypt": "2.4.0", "react-native-blink-view": "0.0.6", "react-native-camera": "3.18.0", "react-native-check-app-install": "0.0.5", "react-native-check-box": "2.1.3", "react-native-code-push": "5.6.1", "react-native-cookies": "3.2.0", "react-native-datepicker": "1.6.0", "react-native-datetime-picker": "1.1.2", "react-native-device-info": "2.3.2", "react-native-easy-grid-view": "0.1.1", "react-native-easy-listview-gridview": "1.0.3", "react-native-easy-toast": "1.2.0", "react-native-error-boundary": "1.1.0", "react-native-fetch-blob": "0.10.8", "react-native-fit-image": "1.5.5", "react-native-flexi-radio-button": "0.2.2", "react-native-fs": "2.14.1", "react-native-image-crop-picker": "0.24.0", "react-native-image-pan-zoom": "2.1.3", "react-native-image-placeholder": "1.0.14", "react-native-iphone-x-helper": "1.2.1", "react-native-keep-awake": "2.0.6", "react-native-keyboard-aware-scroll-view": "0.4.4", "react-native-local-notifications": "2.0.0", "react-native-material-buttons": "0.5.0", "react-native-material-dropdown": "0.9.0", "react-native-material-ripple": "0.8.0", "react-native-material-textfield": "0.12.0", "react-native-modal-dropdown": "0.6.2", "react-native-pdf": "5.0.2", "react-native-permissions": "1.1.1", "react-native-popover-view": "1.0.19", "react-native-progress": "3.4.0", "react-native-push-notification": "3.1.1", "react-native-root-siblings": "3.2.3", "react-native-router-flux": "4.0.6", "react-native-segmented-control-tab": "3.4.1", "react-native-sensitive-info": "5.1.0", "react-native-signature-capture": "0.4.9", "react-native-simple-events": "1.0.1", "react-native-smart-timer-enhance": "1.0.3", "react-native-sound-player": "0.10.1", "react-native-spinkit": "1.3.0", "react-native-sqlite-storage": "3.3.6", "react-native-super-grid": "2.0.2", "react-native-tiny-toast": "1.0.7", "react-native-toast-native": "1.2.1", "react-native-uuid-generator": "3.0.2", "react-native-video": "5.0.0", "react-native-web-service-handler": "1.0.2", "react-native-webview": "10.2.1", "react-native-zip-archive": "2.2.2", "react-redux": "7.2.0", "redux": "4.0.5", "redux-devtools-extension": "2.13.8", "redux-logger": "3.0.6", "redux-persist": "6.0.0", "redux-saga": "1.1.3", "redux-thunk": "2.3.0", "rn-fetch-blob": "0.10.12", "scandit-react-native": "5.18.3", "timespan": "2.3.0", "uuid": "3.2.1", "validator": "10.8.0", "whatwg-fetch": "^3.6.2" }, "devDependencies": { "@babel/core": "7.4.5", "@babel/runtime": "7.4.5", "babel-eslint": "8.2.1", "babel-jest": "24.8.0", "babel-preset-es2016": "6.24.1", "eslint": "4.12.1", "eslint-plugin-babel": "5.0.0", "eslint-plugin-promise": "3.6.0", "eslint-plugin-react": "7.5.1", "jest": "24.8.0", "metro-react-native-babel-preset": "0.55.0", "nsp": "3.2.1", "pre-commit": "1.2.2", "react-test-renderer": "16.8.3" }, "jest": { "preset": "react-native" }, "rnpm": { "assets": [ "assets/fonts/HelveticaNeue-Condensed" ] } }

@chrisbonifacio Tried "whatwg-fetch": "^3.6.2" but still the error.

If the "aws-amplify": "^4.2.3" package is removed from the package.json then everything is working fine - Package used the error occurs.

chrisbonifacio commented 3 years ago

@calebpollman Are you familiar with this error when building Amplify apps with the React Native CLI or have some insight? I can only find instances of this issue happening with Expo.

chrisbonifacio commented 3 years ago

@karthinidc Hello! Apologies for the delay. Unfortunately, I have not been able to reproduce this issue. Are you still experiencing the error and in need of assistance?

karthinidc commented 3 years ago

@chrisbonifacio Hi If use the "aws-amplify": "^4.2.3", version in the "react-native": "0.59.9" version project - Still same issue.

chrisbonifacio commented 3 years ago

we noticed that you're using the Auth library but it seems you're missing some important dependencies in your package.json

did you follow the documentation to set up your React Native Amplify project?

Install the necessary dependencies by running the following command:

npm install aws-amplify aws-amplify-react-native amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage

You will also need to install the pod dependencies for iOS:

npx pod-install
chrisbonifacio commented 3 years ago

Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you. Thank you!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.