Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async await doesn't resolve in non-debugging mode #814

Closed
2 of 5 tasks
peterwiebe opened this issue Jun 7, 2022 · 5 comments
Closed
2 of 5 tasks

Async await doesn't resolve in non-debugging mode #814

peterwiebe opened this issue Jun 7, 2022 · 5 comments
Labels
bug Something isn't working Stale

Comments

@peterwiebe
Copy link

peterwiebe commented Jun 7, 2022

What happened?

I updated the async storage dependency in my project from "@react-native-community/async-storage": "^1.10.1", to "@react-native-async-storage/async-storage": "^1.17.5", and I am now having issues with the app failing silently when I try to prepend await before using AsyncStorage.getItem(key).

It only happens though when not in debug mode on the device. As soon as I remove the await from any getItem calls the code works again with or without debug mode on.

Version

1.17.5

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
    OS: macOS 12.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 221.88 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v14.17.6/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm
    Watchman: 2022.03.21.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: Not Found
    react-native-macos: Not Found
    react-native-tvos:  0.66.3-1
  npmGlobalPackages:
    *react-native*: Not Found

Steps to Reproduce

while I don't have a demo yet, here is are the dependencies
"dependencies": {
"@adobe/react-native-acpanalytics": "^1.3.0",
"@adobe/react-native-acpcampaign": "^1.2.0",
"@adobe/react-native-acpcore": "^1.5.1",
"@adobe/react-native-acpmedia": "^2.3.1",
"@adobe/react-native-acpuserprofile": "^1.2.0",
"@apollo/client": "^3.3.20",
"@react-native-async-storage/async-storage": "1.17.6",
"@react-native-community/hooks": "^2.5.1",
"@react-native-community/netinfo": "6.0.0",
"@react-native-masked-view/masked-view": "^0.2.6",
"@react-navigation/bottom-tabs": "^6.0.9",
"@react-navigation/material-top-tabs": "^6.0.6",
"@react-navigation/native": "^6.0.6",
"@react-navigation/native-stack": "^6.2.5",
"@react-navigation/stack": "^6.0.11",
"@reduxjs/toolkit": "^1.5.0",
"apptentive-react-native": "^5.7.2",
"core-js": "^3.14.0",
"event-emitter": "^0.3.5",
"graphql-tag": "^2.10.3",
"i18n-js": "3.5.1",
"lodash": "^4.17.21",
"lottie-ios": "^3.2.3",
"lottie-react-native": "^4.0.2",
"moment": "^2.29.2",
"patch-package": "^6.2.2",
"postinstall-postinstall": "^2.1.0",
"postscribe": "^2.0.8",
"react": "16.13.1",
"react-device-detect": "^2.1.2",
"react-dom": "^16.10.1",
"react-instagram-embed": "2.0.0",
"react-lazy-load-image-component": "^1.5.0",
"react-loading-skeleton": "^2.1.1",
"react-lottie-hook": "^0.1.0",
"react-native": "npm:[email protected]",
"react-native-ad-manager": "^1.3.7",
"react-native-animated-linear-gradient": "^1.2.0",
"react-native-code-push": "^7.0.1",
"react-native-confirmation-code-field": "^6.5.0",
"react-native-device-info": "^8.3.3",
"react-native-dotenv": "2.4.2",
"react-native-fast-image": "^8.3.3",
"react-native-gesture-handler": "^1.10.3",
"react-native-iap": "^7.5.1",
"react-native-keychain": "^6.2.0",
"react-native-kochava-tracker": "1.5.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^2.1.7",
"react-native-orientation-locker": "1.3.0",
"react-native-pager-view": "^5.4.8",
"react-native-parallax-scroll-view": "https://github.com/fungilation/react-native-parallax-scroll-view.git",
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
"react-native-skeleton-placeholder": "^2.0.7",
"react-native-svg": "^12.1.1",
"react-native-svg-transformer": "^0.14.3",
"react-native-tab-view": "^3.1.1",
"react-native-video": "^5.0.2",
"react-native-view-pdf": "^0.13.2",
"react-native-web": "0.17.0",
"react-native-webview": "^11.4.3",
"react-redux": "^7.2.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-twitter-embed": "^3.0.3",
"react-youtube-embed": "^1.0.3",
"reanimated-bottom-sheet": "^1.0.0-alpha.22",
"redux": "^4.0.4",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.1",
"sass": "^1.49.7",
"subscriptions-transport-ws": "^0.9.16"
},
"devDependencies": {
"@babel/compat-data": "7.12.5",
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"@babel/runtime": "7.12.5",
"@graphql-codegen/cli": "^1.21.5",
"@graphql-codegen/fragment-matcher": "2.0.1",
"@graphql-codegen/introspection": "1.18.2",
"@graphql-codegen/typescript": "1.22.1",
"@graphql-codegen/typescript-operations": "1.18.0",
"@graphql-codegen/typescript-react-apollo": "2.2.5",
"@graphql-modules/core": "^0.7.12",
"@react-native-community/eslint-config": "^0.0.7",
"@rescripts/cli": "^0.0.13",
"@rescripts/rescript-env": "^0.0.11",
"@storybook/addon-actions": "^5.3.19",
"@storybook/addon-backgrounds": "^5.3.19",
"@storybook/addon-docs": "^5.3.19",
"@storybook/addon-graphql": "^5.3.19",
"@storybook/addon-knobs": "^5.3.19",
"@storybook/addon-links": "^5.3.19",
"@storybook/addon-notes": "^5.3.19",
"@storybook/addon-ondevice-actions": "^5.3.19",
"@storybook/addon-ondevice-backgrounds": "^5.3.19",
"@storybook/addon-ondevice-knobs": "^5.3.19",
"@storybook/addon-storyshots": "^5.3.19",
"@storybook/addon-storysource": "^5.3.19",
"@storybook/addon-viewport": "^5.3.19",
"@storybook/addons": "^5.3.19",
"@storybook/preset-create-react-app": "^2.1.1",
"@storybook/preset-typescript": "^1.2.0",
"@storybook/react": "^5.3.19",
"@storybook/react-native": "^5.3.19",
"@types/doubleclick-gpt": "^2019041801.0.2",
"@types/i18n-js": "^3.0.1",
"@types/jest": "^25.1.2",
"@types/node": "^13.7.2",
"@types/react": "^16.9.20",
"@types/react-dom": "^16.9.7",
"@types/react-native": "^0.63.1",
"@types/react-native-video": "^5.0.0",
"@types/react-redux": "^7.1.3",
"@types/react-router-dom": "^5.1.2",
"@types/react-test-renderer": "^16.9.0",
"@types/react-transition-group": "^4.2.4",
"@types/storybook-react-router": "^1.0.1",
"@types/storybook__addon-storyshots": "^5.1.2",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"babel-loader": "^8.0.6",
"babel-plugin-react-native-web": "^0.12.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-inline-import": "^3.0.0",
"eslint": "^7.1.0",
"eslint-plugin-prettier": "^3.1.3",
"express": "^4.17.1",
"graphql": "^14.6.0",
"husky": "^4.2.3",
"jest": "26.6.0",
"lint-staged": "^10.0.7",
"metro-react-native-babel-preset": "^0.64.0",
"react-scripts": "4.0.1",
"react-test-renderer": "16.12.0",
"storybook-react-router": "^1.0.8",
"ts-loader": "^6.2.0",
"ts-node": "8.10.2",
"typescript": "4.3.2",
"webpack-bundle-analyzer": "^3.7.0",
"webpack-cli": "^3.3.11"
},

@peterwiebe peterwiebe added the bug Something isn't working label Jun 7, 2022
@dchvz
Copy link

dchvz commented Jun 14, 2022

Same thing happened to me on version 1.17.6
I realized that this issue happened when I installed Storybook dev dependencies, because I removed all storybook related changes and it was working normally again. These are my dependencies, hope that is useful:

"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.6",
"@react-navigation/native": "^6.0.6",
"@react-navigation/native-stack": "^6.2.5",
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.1",
"react-native-svg": "^12.3.0",
"react-native-svg-transformer": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@storybook/addon-actions": "^5.3",
"@storybook/addon-knobs": "^5.3",
"@storybook/addon-links": "^5.3",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.25",
"@storybook/react-native": "^5.3.25",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.5",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-dom": "17.0.2",
"react-test-renderer": "17.0.2"
},

@dchvz
Copy link

dchvz commented Jun 14, 2022

This storybook issue talks about a warning that is popping up with storybook. I mention this because by applying the solution that is mentioned here, I was able to use the library properly.

In summary, the solution is to set inlineRequires: false in metro.config.js.

Hope that helps at least for now

@dchvz
Copy link

dchvz commented Jun 14, 2022

Here is another issue that reports that inlineRequires disables async storage. The fix they suggest which is setting inlineRequires: false in metro.config.js may not be the best on the long run.

@MichDreby
Copy link

MichDreby commented Jun 16, 2022

The same issue for me. During upgrading react-native to 0.68 (fabric, new architecture) I have to set up inlineRequires: true in the metro config or android build will not work. Right now AsyncStorage.getItem just hangs on.
Help needed.

@krizzu

@github-actions
Copy link

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

3 participants