-
Notifications
You must be signed in to change notification settings - Fork 660
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 0.62.1 [iOS] - Empty config file in JS #444
Comments
Hi @ahartzog Do you have a reproducible demo? |
@luancurti I do not, unfortunately other demands on my time mean I can't spin up a brand new 0.62 and re-create this If this issue is common as people upgrade to 0.62, I'd like to see where we land. If it isn't, then I'll just have to find which esoteric hidden mis-configuration in my project is causing the issue. Thank you for the response! |
RN 0.62.2 I managed to solve it by deleting this workaround #414 (comment) and deleting workaround in Podfile
Then I run
|
@ahartzog try to remove The ruby script tries to find env file firstly from tmp/envfile. Then if it doesn't find anything searches in ENVFILE variable. Hope this helps |
@makarkotlov good call on clearing out the react-native-config, I had forgotten to do that when updating from manual linkage. Running the link on it isn't changing anything in the iOS config for me (and autolinking should work right in theory, according to @luancurti in another post) I'm still not seeing my env variables in my JS - I've noticed that the pre-build script Creates that envfile inside private/tmp - and then I still have no idea what this file is supposed to be doing or pointing to. Should I point it to my actual env file with an "absolute" url e.g. Somebody mentioned that this file just works as a pointer to the actual file - I've also tried deleting it like the prior poster mentions but as far as I can tell this has no effect. Still trying to figure this out here - would appreciate any additional ideas. |
I went ahead and tried @maxkomarychev 's new library, react-native-ultimate-config. So far so good, iOS worked easily. Android fired up like a charm once I removed all the manual crap I had in place from RNC. JS config works, build configs work. I would consider moving back to this when it's actually a part of react-native-community and supported, but until then I'll be with RNUC. |
I am facing issue in reading the config value it is undefined on reading Config.API_URL with the import Config from "react-native-config"; Only issue is with Ios and works fine with Android platform |
Could you please give us more info? |
i had to restart my machine, it works for me. |
For me ( import Cfg from 'react-native-config';
console.warn('CONFIG', Cfg); prints:
I suspect it's loading this. EDIT: // iOS:
import Cfg from 'react-native-config'; // Returns react-native-config.js contents.
import Cfg from 'react-native-config/index'; // Returns .env file contents. 🤯 |
@wbercx But the file with dependencies you've mentioned is called |
🤦 You're absolutely right. Thanks for pointing that out. It's been a while since one character cost me this much time haha. |
If you are using Pods just add (without
|
I installed the package according to the instructions, and it worked... for a while. After switching branches, with code changes, etc., the config started returning an empty object.
|
Hello, I'm having the same problem with the latest version, but for Android on Windows. OS - Windows 10 Pro 64-bit I've tried everything in the documentation and supposed fixes from random issues. Anyone else having this issue? Edit: |
Unless I name one of my files to
|
I was able to get it to work by changing the Pre-action Build script to:
|
@MattyK14 Thanks that worked for me! |
The However, I could not get the pre-action work using the |
IOS: this in pre-action worked for me
this not:
update: |
I have installed react-native-config according to docs and I have empty config. Sure, but why we have such a case? |
so I have to correct something for 9 days this worked:
for 2 days this worked and yesterday no one of the above commands worked: I think the pre-actions are being executed too late, at the moment i'm copying my stage env variables manually into .env |
Hello guys! I am having this exact same issue with react-native 0.63.2 and react-native-config 1.3.2. Is there a workarround for this? Cannot make it work on iOS, Android works fine Thanks! |
My problem was that I mistakenly added (Could not get the more clean |
@ronkot Thanks for your reply, I have already tried that without success :( My project structure is Should I write echo ".env.production" > /tmp/envfile or echo "../.env.production" > /tmp/envfile ? |
Works for me too. But to change the info.plist information like the display name I've created two different targets, I couldn't read any entry of the config... |
I ended up using the following, since I only need them to be visible on the React Native (JS) side. staging.json scripts/set-environment.js
Finally, I call staging or prod depending on the case
|
same error here with the solution from the docs |
I was wondering if anyone found a potential fix. Still having the issue of the empty config file after following the official documentation in step number 6 (iOS). React Native v0.63.2 |
I was having this issue today but i was getting values had changed in my |
Make sure you remove |
It happened to me as well. You can probably guess that the second Of course you need to have an empty |
Hey folks,
Just upgraded my project to react-native 0.62.1
In addition, I migrated react-native-config from 0.11.5 all the way to 1.0.0
I've updated my info.plist variables to match the new formatting, removed the old pre-processing scripts, added my build pre-actions copy and xcconfig setup. I believe my info.plist is actually pulling in variables properly, huzzah!
However, inside my actual JS, my Config

Is giving me a blank object.
I'm still loading in the envfiles the exact same way as before.
If other folks upgrading are experiencing this, or if anyone has direction for me, it would be hugely appreciate.
The text was updated successfully, but these errors were encountered: