-
Notifications
You must be signed in to change notification settings - Fork 594
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
[React Native] API calls don't work when using chrome debugger #929
Comments
This issue is reproducable in master branch of /~https://github.com/aws-samples/aws-sdk-js-tests. I tried look into where the RN debugger gets deactivated, and I find it's around returning the promise from Sha256 functions, from When debugger steps into: return util_locate_window_1.locateWindow().crypto.subtle.digest(constants_1.SHA_256_HASH, _this.toHash).then(function (data) {
return new Uint8Array(data);
});
}; The The root cause is unknown, but I find I can workaround it by forcing |
After more investigation, the cause is more clear: the crypto package uses This behavior can be validated by adding inline console log in function Sha256(secret) {
if (supports_web_crypto_1.supportsWebCrypto(util_locate_window_1.locateWindow())) {
console.log('WebCrypto')
this.hash = new webCryptoSha256_1.Sha256(secret);
}
else if (ie11_detection_1.isMsWindow(util_locate_window_1.locateWindow())) {
console.log('MSCrypto')
this.hash = new ie11Sha256_1.Sha256(secret);
}
else {
console.log('PUREJS')
this.hash = new sha256_js_1.Sha256(secret);
}
} In debug mode, console log prints:
In non-debug mode, console log prints:
The same behavior is also confirmed in react-native-cli Conclusion: Hypothetically, Expo may fall back to /~https://github.com/expo/expo/tree/master/packages/expo-crypto but this native package requires event loop moves over from JS side to native side. So user s need to touch screento make event loop progress. I'm working with the crypto package owner to get this resolved on that side |
A fix that makes RN bundles using pure JS SHA256 implementation is released in 1.0.0-alpha.27. I have validated locally. Please ask for reopen if the same issue persists. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Describe the bug
When chrome debugger is attached to the ios simulator (or Android emulator), calls to AWS services do not finish for a long time. Making another service call triggers previous call to finish. For instance let's say the app logs
Sending Request
before making the request andRequest succeeded
once the request completes, we only seeSending Request
but notRequest succeeded
until other API call is made.SDK version number
Latest alpha client versions as of now.
Is the issue in the browser/Node.js?
React Native
Details of the browser/Node.js version
I'm using React Native 0.61.5 and RN CLI to create the app.
To Reproduce (observed behavior)
S3:PubObjects
API and addconsole.log
before and after the call.It doesn't happen when not using chrome debugger.
Expected behavior
There shouldn't be any issues using RN with chrome debugger.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: