Is there a way to solve this? - react-native

I do not know why my bundling command (eas build --platform android) keeps returning this error: CombinedError: [GraphQL] Entity not authorized: AccountEntity[bf4d40b0-5121-4c66-96ed-6be99586c703] (viewer = RegularUserViewerContext[2200e4b1-4483-428d-87f3-0643e995c424], action = READ,
ruleIndex = -1)
I do not know why my bundling command (eas build --platform android) keeps returning this error: CombinedError: [GraphQL] Entity not authorized: AccountEntity[bf4d40b0-5121-4c66-96ed-6be99586c703] (viewer = RegularUserViewerContext[2200e4b1-4483-428d-87f3-0643e995c424], action = READ,
ruleIndex = -1)

As per this link, your projectId may be messed up.
https://github.com/expo/eas-cli/issues/1324
Make sure projectId is correct in app.json file

Related

How do I customize the location of index.js with Sentry in React Native?

Our bundle entry point is at src/index.tsx, which appears not to match the Sentry default of ./index.js.
Sentry is failing on sentry-cli react-native-xcode with the error EOF while parsing a value at line 1 column 0.
Using debug log level, I see:
+ ENTRY_FILE=index.js
...
Error: The resource `/Users/lukecwilliams/Projects/mobile2mr/index.js` was not found.
And in the actual CLI command, this is being run: --entry-file index.js
We need instead --entry-file src/index.tsx. How can we customize this? I can't find an answer in the docs or source code.
I've found this solution (custom build script) but it's still not working.
I have a script in the project root:
sentry-cli-xcode-build.sh:
./node_modules/react-native/packager/react-native-xcode.sh ./src/index.tsx
And in the build command in project.pbxproj:
shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nexport NODE_BINARY=node\n../node_modules/#sentry/cli/bin/sentry-cli react-native xcode ../sentry-cli-xcode-build.sh";
But the result is a fairly ambiguous: error: Permission denied (os error 13)
Do I need to change the directory setup somehow? I don't see a concrete example in Sentry docs or the GH answer above regarding where to put the script and how to reference it exactly.
It turns out that this build step should simply be disabled in iOS projects using Bitcode (which is the default). So, we have no more need to run a custom build script.
We'll use Fastlane afterward to upload debug symbols.
Docs for reference:: https://docs.sentry.io/platforms/react-native/#ios-specifics
The answer is
export ENTRY_FILE=index.ios.js
in the script

React native link fails with no package found

I'm not sure what exactly is happening but I am unable to run react-native link without errors occuring
CLI Output:
react-native link --verbose
debug Available platforms: iOS, Android
debug Targeted platforms: iOS, Android
debug Getting project config for iOS...
debug Getting project config for Android...
error No package found. Are you sure this is a React Native project?
error Unexpected close tag
Line: 22
Column: 24
Char: >
debug Error: Unexpected close tag
Line: 22
Column: 24
Char: >
at error (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:692:7)
at closeTag (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:885:9)
at SAXParser.write (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:1447:13)
at new XmlDocument (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/lib/xmldoc.js:199:15)
at readManifest (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/tools/android/readManifest.js:44:10)
at Object.projectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/tools/android/index.js:66:46)
at Object.keys.forEach.platform (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/commands/link/getProjectConfig.js:25:62)
at Array.forEach (<anonymous>)
at getProjectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/commands/link/getProjectConfig.js:22:35)
This randomly started happening after attempting to npm install react-native-firebase.
What I've tried
clear-caches
remove node_modules and npm install
Checking out my code back to a previous commit
Adding my package name to the manifest locaed in /android/app/src/debug/AndroidManifest.xml
Removing the app from my computer and cloning it from github
Running react-native link on another project, which works, but i just can't run react-native link on this specific project.
So the answer to my question was that in my android manifest xml file, there was an incorrect closing brace for one of my intent filters.
So for anyone that this happens to ensure that all of your Android files have correct syntax.
I fixed this problem by closing some unclosed tag in android/app/src/main/androidManifest.xml. Try checking the file line by line.

React - native developement server return response error code : 500

I'm building an application in react-native, everything was working fine .After npm install, react-native doesn't detect some of my files anymore saying it doesnt exist, doesn't seem to detect any changes either. I get
"Developpement server returned response error 500, unable to resolve module `../services/myFile` none of these files exist." on android and on IOS 'Failed to load Bundle with error: "unable to resolve module ./screens/anotherFile"
When I remove those files (from the files they are use in) the error is still the same. Any ideas ?
Like #firu said, make sure you do a react-native-link, this happens if you have deleted the ios or android folder. Most cases when you are upgrading react-native with react-native-upgrade

How to trace JavascriptException index.android.bundle:424:4194 to line number in JS source?

Google Play stack trace points the cause of crash at:
com.facebook.react.modules.core.JavascriptException: addWaypointDone
index.android.bundle:424:4194
I extracted index.android.bundle from the apk.
How do I get a JS source code line number from 424:4194 ?
Thanks Daniel. Your approach worked for me from the command-line!
I tried adding this to android/app/react.gradle but I could not find and source.map file under the ./android directory.
commandLine "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}”,
"--sourcemap-output", "source.map",
"--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets dest", resourcesDir
Is there a way to auto-build source.map file very time?
Thanks in advance,
To get an exact position you need a source map. If you don't keep those for your deploys you can regenerate it.
Check out the exact version you deployed from your VCS
Bundle it with source map output: react-native bundle --entry-file index.android.js --platform android --dev false --sourcemap-output source.map --bundle-output main.jsbundle (make sure you use the exact same dependency versions you used in your release)
Create a file findpos.js containing the following code:
findpos.js
var sourceMap = require('source-map');
var fs = require('fs');
var sourcemap = JSON.parse(fs.readFileSync('source.map', 'utf8'));
var smc = new sourceMap.SourceMapConsumer(sourcemap);
console.log(smc.originalPositionFor({
line: 424,
column: 4194
}));
Execute the script node findpos.js
You should get the exact location of the error (file, line and column).
How to use Atom to find the exception source code in the index.android.bundle
Get stack trace from Google Play
Rename the apk file with a zip extension and extract apk
Using Atom or other editor, open up the extracted '''assets/index.android.bundle''
Edit > Go to Line , from stack trace, 424:4194
All white-space is removed from the index.android.bundle and lines are concatenated to a single line. But it identifies the culprit.

How to disable react native warning message at the bottom

I'm working on a react-native IOS app, and this app sometimes will raise a Warning message "setState(...) Can only update a mounted or mounting component. ...", I understand what the message is about, it is caused by the long time AJAX call.
Considering this warning will not cause any serious issue for the APP, I don't want to spend much time to fix it at this moment, this warning message will show up in both simulator and cellphone while loading from development server. My question is whether the warning message will still prompt in product mode (Load from pre-bundled file)? If it will still show up, how to disable this Warning message from configuration?
Thanks.
the better solution is to write this in your index file:
console.disableYellowBox = true;
To disable only this warning message use the following code on possible files
console.ignoredYellowBox = ['Warning: setState(...)'];
To disable only the setState message
The "setState(...) Can only update a mounted or mounting component." is thrown from 4 possible files :
node_modules/react/dist/react-with-addons.js
node_modules/react/dist/react.js
node_modules/react/lib/ReactNoopUpdateQueue.js
node_modules/react/lib/ReactUpdateQueue.js
I don't know which one triggered yours, but you can modify those files to not show the warning. If your concern is for your users, that is to say in release mode, then the dev flag is false which means that will not see any warning messages.
To disable all warnings
To disable the warnings, just change this in your AppDelegate.m :
jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
to
jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle?platform=ios&dev=false"];
If you're using the pre-bundled file you'll have to specify dev as false when bundling :
react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios
Just to answer to question you asked, no, the warning will not show up when you load from a pre-bundled file (like when testing with TestFlight).
I edited my App.js file and added this:
console.ignoredYellowBox = ['Warning: Can only update a mounted', '-[EXCamera updateFocusDepth'];
You can provide an array of things you want to ignore. Simply provide a prefix of ones you want to ignore, no '*' or other wildcard required.
For Remote debugger
console.ignoredYellowBox = ['Remote debugger'];
and for all warning
console.disableYellowBox = true;