skip to Main Content

I have a React native project developed by external developers. The application is deployed for IOS on Apple App Store Connect. Chat feature developed on freshchat is not working. When I try to debug I found that APP ID,API KEY and Domain for freshchat are being referenced from the code. I can not seem to find the env file containing the APP ID,API KEY and Domain in the code. The code is deployed on Apple App Store Connect. Where could these variables lie in the Apple App Store connect?

`import Config from 'react-native-config';`
`const configureFreshChat = () => {
let freshchatConfig = new FreshchatConfig(
  Config.FRESHCHAT_APP_ID,
  Config.FRESHCHAT_API_KEY,
);
freshchatConfig.domain = Config.FRESHCHAT_DOMAIN;
freshchatConfig.cameraCaptureEnabled = false;
Freshchat.init(freshchatConfig);
};`

Freshchat is not working for IOS mobile app deployed on Apple App Store Connect.
Based on my research env files are not stored on the version control system . It is not referenced using api call.So it might be on Apple App Store Connect. I am expecting that if the env file is missing containing the variables upon adding those I could fix the chat not working.

3

Answers


  1. Often times, people believe that .env or (any .env.*) files should not be included in version control system such as git.

    However, frontend project such as SPA web application or mobile apps could or should include these files in version control since those values will be accessible or exposed to end users.

    So if engineers built your app believed that it’d better to put it off from VCS, then you should ask them to hand off including those .env (or any config) files for you to run it yourself.

    Login or Signup to reply.
  2. One of my project uses react native and .env file and uses this package https://www.npmjs.com/package/react-native-config

    Often times, .env file is being copied to other places to have multiple environments to run your app with.

    In my case, it is ios/tmp.xcconfig being copied from .env or .env.production file.
    So please check the code to see where the file could be located.

    This script in xcode instruct the building process to copy .env file to a certain location.
    enter image description here

    Login or Signup to reply.
  3. react-native-config allows you to easily change configuration parameters during development type, typically using a simple shell trick of changing an environment variable to load one file instead of another. Those values are loaded and used dynamically while in development mode (though RN sort of forces a rapid rebuild to get new values into the running instance).

    At build time, the same thing happens: the values are read from the .env (or .env.production or whatever) and compiled into the app. Those values are now locked into the app’s binary, and that is what gets deployed to the App Store.

    The values are NOT dynamically read at app start time. They are dynamically read (and fixed) at build time.

    It sounds like the external devs didn’t provide you with the .env values they used when they built your production app. Those values will be the key values from your Freshchat account. So that is where you want to go looking for the values and put them into your own .env file. There might be multiple Freshchat API keys in your account for different environments (dev, staging, production).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search