App crash on production

Please provide the following:

  1. SDK Version: 41 (and 40, same issue)
  2. Platforms : Android/iOS

My app works correcly in dev mode but, since one month, the production mode not work anymore and I can build the application but iOS and android builds crashed before launch.
If I run with production mode on emultaor, the application crash too on Android and log this error on iOS :

Error: invalid host

validate
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:983:2375
value
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:983:8800
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:981:213
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:932:183
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:931:317
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:1087:480
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:1086:691
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:1366:231
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:705:308
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:438:352
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:6:60
v
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:1473
d
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:2:875
global code
    AppEntry.bundle?platform=ios&dev=false&hot=false&minify=true:1810:3

My configuration is :

  Expo CLI 4.4.1 environment info:
    System:
      OS: macOS 11.2.3
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.15.3 - /usr/local/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.9 - ~/.npm-global/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.10.1 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
      Android SDK:
        API Levels: 23, 28, 29, 30
        Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.1, 30.0.2, 30.0.3, 31.0.0
        System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-R | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 4.1 AI-201.8743.12.41.6953283
      Xcode: 12.4/12D4e - /usr/bin/xcodebuild
    npmPackages:
      expo: ^41.0.0 => 41.0.0 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz => 0.63.2 
    npmGlobalPackages:
      expo-cli: 4.4.1
    Expo Workflow: managed

I try to comment all in my App.jsx and the application don’t crash only if I return a simple View.

My App.jsx is the following :

import React, { useEffect, useRef } from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import * as SplashScreen from 'expo-splash-screen';
import { Root } from 'native-base';
import dayjs from 'dayjs';

// Configure dayjs to handle object
var objectSupport = require('dayjs/plugin/objectSupport');
var utc = require('dayjs/plugin/utc');
require('dayjs/locale/fr');
dayjs.extend(objectSupport);
dayjs.extend(utc);
dayjs.locale('fr');

// Reactotron config (DEV ENV)
if (__DEV__) {
  import('./ReactotronConfig');
}

// Navigation
import RootNavigator from './src/config/RootNavigator';

// Local component
import { NofificationContextProvider } from './src/hooks/useNotificationModal';

// Notifications
import Notifications, { handleNotification } from './src/notifications';

// Redux
import { store, persistor } from './src/redux/configureStore';
import {
  actionRefreshChannelGroup,
  actionRefreshMessagesChannelUser,
  actionUserSetLoggedIn,
  actionSetTokens,
} from './src/redux/actions';

export default function App() {
  const notificationListener = useRef();
  const responseListener = useRef();

  useEffect(() => {
    // This listener is fired whenever a notification is received while the app is foregrounded
    notificationListener.current = Notifications.addNotificationReceivedListener((notification) => {
      handleNotification(notification, false);
    });

    Notifications.addNotificationsDroppedListener(handleNotification);

    // This listener is fired whenever a user taps on or interacts with a notification
    // (works when app is foregrounded, backgrounded, or killed)
    responseListener.current = Notifications.addNotificationResponseReceivedListener((response) => {
      handleNotification(response.notification, true);
    });

    return () => {
      Notifications.removeNotificationSubscription(notificationListener);
      Notifications.removeNotificationSubscription(responseListener);
    };
  }, []);

  useEffect(() => {
    // Prevent auto hide splash screen to hide it manualy in RootNavigator after required data are loaded
    SplashScreen.preventAutoHideAsync();
  }, []);

  return (
    <Provider store={store}>
      <PersistGate persistor={persistor}>
        <Root>
          <SafeAreaProvider>
            <NofificationContextProvider>
              <RootNavigator />
            </NofificationContextProvider>
          </SafeAreaProvider>
        </Root>
      </PersistGate>
    </Provider>
  );
}

Thank you in advance for your help

Hey @ludolamerre, there’s a lot going on in your code. I would recommend adding each piece one by one until you can hone in on the culprit. I would also recommend taking a look at our guide on debugging production crashes: Debugging - Expo Documentation

Cheers,
Adam