NODE_ENV=production won't build

Please provide the following:

  1. SDK Version: 49
  2. Platforms(Android/iOS/web/all): iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am moving our application to utilize multiple environment files and utilizing NODE_ENV=“production/staing/development” When building for staging & development everything builds and works great. However production doesn’t work correctly. The app installs but doesn’t have an icon nor a splash screen and Ive verified that my app.config.ts file is reading from the environment file correctly. I also get a crash upon launch ‘NSInternalInconsistencyException’, reason: ‘updateUrl must have a valid scheme’ I checked the expo.plist file and there is a placeholder for EXUpdatesURL.

app.config.ts

import { ExpoConfig, ConfigContext } from 'expo/config';

const ENV_VARIABLES = process.env;

const IS_PROD = ENV_VARIABLES.ENVIRONMENT === 'PRODUCTION';

export default ({ config }: ConfigContext): ExpoConfig => ({
    ...config,
    version: '1.2.40',
    name: ENV_VARIABLES.NAME,
    slug: ENV_VARIABLES.SLUG,
    icon: ENV_VARIABLES.ICON,
    orientation: 'portrait',
    owner: 'owner',
    updates: {
        url: 'some-url',
    },
    runtimeVersion: {
        policy: 'sdkVersion',
    },
    splash: {
        image: ENV_VARIABLES.SPLASH,
        resizeMode: 'contain',
        backgroundColor: '#000000',
    },
    assetBundlePatterns: ['**/*'],
    ios: {
        bundleIdentifier: ENV_VARIABLES.BUNDLE_IDENTIFIER,
        config: {
            usesNonExemptEncryption: false,
        },
        infoPlist: {
            NSLocationAlwaysUsageDescription:
                'Location is needed to ensure unit check in and check out are at the appropriate locations.',
            NSLocationWhenInUseUsageDescription:
                'Location is needed to ensure unit check in and check out are at the appropriate locations.',
            NSCameraUsageDescription:
                'This app uses the camera to let user put a photo in his profile page, and send media to managers.',
            NSPhotoLibraryAddUsageDescription:
                'This app uses the library permissions to allow the user to upload profile images, and send media to managers.',
            NSPhotoLibraryUsageDescription:
                'This app uses the library permissions to allow the user to upload profile images, and send media to managers.',
        },
    },
    android: {
        package: ENV_VARIABLES.ANDROID_PACKAGE,
        adaptiveIcon: {
            foregroundImage: ENV_VARIABLES.ICON,
        },
        // googleServicesFile: './google-services.json',
        permissions: [
            'android.permission.CAMERA',
            'android.permission.ACCESS_COARSE_LOCATION',
            'android.permission.ACCESS_FINE_LOCATION',
            'android.permission.FOREGROUND_SERVICE',
            'android.permission.INTERNET',
            'android.permission.READ_EXTERNAL_STORAGE',
            'android.permission.RECORD_AUDIO',
            'android.permission.SYSTEM_ALERT_WINDOW',
            'android.permission.VIBRATE',
            'android.permission.WRITE_EXTERNAL_STORAGE',
        ],
        allowBackup: false,
    },
    plugins: [
        [
            'expo-build-properties',
            {
                ios: {
                    flipper: !IS_PROD,
                },
            },
        ],
        [
            'expo-notifications',
            {
                color: '#ffffff',
            },
        ],
        [
            'expo-image-picker',
            {
                photosPermission:
                    'The app accesses your photos to let you share them with the managers.',
                cameraPermission:
                    'The app accesses your camera to let you share photos and videos with the managers.',
                microphonePermission:
                    'The app accesses your microphone to let you share videos with the managers.',
            },
        ],
        'sentry-expo',
    ],
    extra: {
        eas: {
            projectId: ENV_VARIABLES.EXPO_PROJECTID,
        },
    },
    hooks: {
        postPublish: [
            {
                file: 'sentry-expo/upload-sourcemaps',
                config: {
                    organization: 'companytest-df',
                    project: '',
                    authToken: ENV_VARIABLES.SENTRY_AUTH_TOKEN,
                },
            },
        ],
    },
});

.env.production

EXPO_PUBLIC_ENVIRONMENT="PRODUCTION"
NAME="App name"
SLUG="app-slug"
ICON="./assets/icon.png"
BUNDLE_IDENTIFIER="com.company.app"
ANDROID_PACKAGE="com.company.app"
EXPO_PUBLIC_API_URL="https://app.ca"
EXPO_PROJECTID="projectid"
SENTRY_AUTH_TOKEN="authtoken"
SPLASH='./assets/splash.png'

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.