SocketIO throws "Can't find variable: Reflect" on bad requests if chrome debugger is not connected - react-native

This is for both Android and IOS. I am using feathersjs by the way.

It seems one of the causes for this error is not importing babel-polyfill as suggested on the docs (for react-native).
Check this issue https://github.com/feathersjs/feathers/issues/395
And here the feather's react-native section on the docs
https://docs.feathersjs.com/clients/feathers.html#usage-with-react-native

Related

EXPO + react-native-reanimated debug issue

I've had an app running on Expo SDK 41 and it had some basic usage of react-native-reanimated#~2.1.0 and debugging worked just fine.
At some stage SDK 41 was deprecated and I was forced to upgrade, so I went for the latest one which is 45.
After the upgrade I can no longer use remote debugging. When I turn on remote debugging, the app crashes with the following error
Requiring module "node_modules\react-native-reanimated\src\Animated.js", which threw an exception: Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome.
Consider providing alternative methods to expose this method in debug mode, e.g. by exposing constants ahead-of-time.
and I can't do anything (I can't even turn off remote debugging without clearing expo app data).
The issue seems to be related to react-native-reanimated (current version is 2.8.0)
Expo docs state this:
The new APIs in react-native-reanimated#2 use React Native APIs that
are incompatible with Remote JS Debugging. Consequently, you can only
debug apps using these APIs using Flipper, which is not yet available
in the Expo managed workflow. You will be unable to use Remote JS
Debugging if you use the new APIs from Reanimated 2. Remote JS
Debugging will continue to work if you only use the APIs that were
also available in Reanimated 1.
Tried to downgrade to react-native-reanimated#~2.1.0 did not work either.
I must be missing something, because otherwise it seems a bit ridiculous that I'm forced to upgrade SDK which in combination with react-native-reanimated does not allow me to do debug anymore.
Please advise if there is anything I can do.
Thanks
This is what that link to Expo's docs show me at this time:
Reanimated uses React Native APIs that are incompatible with "Remote JS
Debugging" for JavaScriptCore. In order to use a debugger with your app with
react-native-reanimated, you will need to use the Hermes JavaScript engine and > the JavaScript Inspector for Hermes.
Anyways, this appears to be an issue Reanimated themselves talk about in the docs
The workaround around this for some time has been this code shared in this answer here
It isn't even a reanimated problem particularly, but an inability of RN to develop using some synchronous features that pertain to debugging.
Anyways, hope this helps you
After posting a question on expo repository, I've got the following answer which actually does not solve the remote debugger issue, but gives the same alternative. Basically they suggested to use hermes engine
hi there! this is unfortunate and inconvenient for sure. it's a side effect of the direction the ecosystem is moving in - away from JavaScript Core and remote debugging in Chrome towards Hermes and attaching a debugger to the on-device Hermes engine. Reanimated no longer supports remote debugging in Chrome.
in order to debug JS using Reanimated in SDK 45+ we recommend using Hermes. you can set this up in your app.json as follows:
{
"expo": {
"// your other config here": "...",
"android": {
"jsEngine": "hermes"
}
}
}
now when you run expo start and launch your app press j and it will launch a Chrome Inspector that will attach directly to the app on your device (I suggest upgrading expo-cli to the latest to ensure you have this feature). be sure to refer to the "Using Hermes Engine" guide for more information

Nativescript Vue DevTools - vue-devtools stuck "Waiting for connection..."

I cannot manage to get the Vue DevTools running with my iOS Nativescript Project. I followed exactly the instruction on https://nativescript-vue.org/en/docs/getting-started/vue-devtools/ but the Nativescript App does not connect to vue-devtools.
I'm working on a Mac having latest Nativescript 8.1.3 installed, nativescript-vue-devtools is version 1.5.1.
One thing I notice is the error message ReferenceError: SocketManager is not defined as soon as I put Vue.use(VueDevtools) into the code. This error message always appears, I tried several Simulators with different iOS version, I also tried a physical device. I also tried with a "fresh" blank Vue project, leaving completely unchanged but just adding the Vue Devtools, same error.
Anyone out there who managed to get this working?
Thank you for your help.

Troubleshooting Maximum Stack Call Size Exceeded Error in Expo App

I'm getting the infamous Maximum Stack Call Size Exceeded error in Expo app.
I understand that it's caused by code that keeps calling itself, creating an infinite loop.
Does Expo or React Native provide more information about where this error is? I've already been through my code and didn't find anything. Something a bit more specific would be helpful in narrowing down the issue.
What's evn more interesting in this case is that I only get the error in the Expo Go app. When I run the app in Android Emulator, I don't get the error and the app works fine.
Any suggestions?
I found the culprit and it's totally unexpected.
I develop web front-end in React and mobile in React Native. One of the primary reasons is code sharing.
I have a file that contains all the action types I use in managing the state of my app. Technically not but kind of an enum file. They look like this:
export const SET_IS_AUTHENTICATED = 'SET_IS_AUTHENTICATED';
export const SET_USER_INFO = 'SET_USER_INFO';
In this file, I have exactly 486 action types and this is exactly what was creating the error.
I don't need all of these action types in my mobile app but I'd decided to keep things consistent and I thought this was totally harmless so I've been sharing this enum file in all my React and React Native apps.
Here are two interesting observations:
I just started developing with Expo. Prior to that I was using straight React Native -- created through React Native CLI and I NEVER got any errors for using this file.
Even more interesting is that the Android Emulator does NOT throw any errors in the same project. Only the Expo Go app throws this error.
This may even be by design and not necessarily an undesired side effect of the Expo Go app. Not sure. I'd love to know if others have had similar experiences with the Expo Go app.
This is probably not helpful, but when I upgraded from expo sdk 41 to 43 then I started getting this error. I made no code changes besides the upgrade and now when my app loads I get the error Unhandled promise rejection, [RangeError: Maximum call stack size exceeded.]. I get the error on expo go on both platforms

React-native does not support IPFS?

I installed IPFS in my app and whenever I am trying to use it I always get this error.
Error: undefined Unable to resolve module `crypto` from `node_modules/libp2p-crypto/src/hmac/index.js`
I searched on google and found article which says it is impossible to use IPFS on mobile device.
But this article was created almost 1 year ago and I was wondering is it still true for react-native?
Is there any ways to solve my problem?
To query an IPFS node I use ipfs-mini
Works great for my react-native app.

React native app sourcemaps show incorrect location of error when error happens in asynchronous code

I have a react-native app. I recently moved to react-native version 0.61.5 for which I took the long route of creating a new react-native app and porting my code over to avoid any linking issues since new version used PODFILE as the default linking mechanism. Ever since I moved to version 0.61.5, I don't get the correct location of code in error logs. I think this is mainly happening when the code is running in asynchronous fashion which most of the code is. For e.g., look at below screenshot:
It is reporting that it is not able to call map on some array which is apparently undefined but the place where the error is reported is completely incorrect. I have no such file in my codebase and it is probably pointing to some file in some react-native package.
I am using Sentry #sentry/react-native": "^1.1.0". I don't think Sentry can cause issue with the sourcemaps reported during development.
I am not sure how to debug this problem. This problem is causing a lot of issues in debugging any errors as I have to manually figure out where the error happened. Please let me know if you have any tips on how to fix this problem.