expo: Manifest missing originalFullName in EAS Build Development Client

Summary

Manifest is missing originalFullName and currentFullName (and id) when using custom EAS Build Development client.

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android, iOS

Package versions

Only native and expo packages listed:

{
  "dependencies": {
    "expo": "^42.0.0",
    "expo-application": "~3.2.0",
    "expo-asset": "~8.3.2",
    "expo-auth-session": "~3.3.1",
    "expo-camera": "~11.2.1",
    "expo-constants": "~11.0.1",
    "expo-dev-client": "^0.4.3",
    "expo-device": "~3.3.0",
    "expo-image-picker": "~10.2.2",
    "expo-linear-gradient": "~9.2.0",
    "expo-linking": "~2.3.1",
    "expo-localization": "~10.2.0",
    "expo-notifications": "~0.12.2",
    "expo-random": "~11.2.0",
    "expo-secure-store": "~10.2.0",
    "expo-splash-screen": "~0.11.2",
    "expo-standard-web-crypto": "^1.0.2",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "~0.8.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-reanimated": "~2.2.0",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "~3.4.0",
    "react-native-svg": "12.1.1",
    "sentry-expo": "^4.0.0",
  }
}

Environment

Expo CLI 4.7.2 environment info:
    System:
      OS: Windows 10 10.0.19042
    Binaries:
      Node: 12.18.2 - ~\AppData\Local\Temp\yarn--1625626459530-0.2547605146813341\node.CMD
      Yarn: 1.22.10 - ~\AppData\Local\Temp\yarn--1625626459530-0.2547605146813341\yarn.CMD
      npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      expo: ^42.0.0 => 42.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-42.0.0.tar.gz => 0.63.2
      react-native-web: ~0.13.12 => 0.13.18
    Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

  1. Create new expo 42 project
  2. Create a development client:
{
  "builds": {
    "android": {
      "debug": {
        "workflow": "managed",
        "buildType": "development-client",
        "releaseChannel": "test.42.0",
        "distribution": "internal"
      }
    }
  }
}
  1. Try to create a redirect URI:
const useProxy = Platform.select({ web: false, default: true });
const redirectUri = AuthSession.makeRedirectUri({ useProxy });
  1. Start expo start --dev-client
  2. Install the dev client and connect
  3. It breaks

I went into node_modules\expo-auth-session\build\SessionUrlProvider.js and added console.log({ manifest }). I can see in the log that both originalFullName and currentFullName are missing.

expo config --type public

This correctly shows originalFullName and currentFullName.

Workaround

import Constants from 'expo-constants';
Constants.manifest.originalFullName = '@org/project';

Right before AuthSession.makeRedirectUri

Stacktrace (if a crash is involved)

SessionUrlProvider.js

Error: Cannot use AuthSession proxy because the project ID is not defined. Please ensure you have the latest version of expo-constants installed and rebuild your native app. You can verify that currentFullName is defined by running expo config --type public and inspecting the output.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 28 (4 by maintainers)

Most upvoted comments

It’s not resolved.

It seems you’re using eas anyway.

Yes but I do have this issue using eas! By the way, I’m not trying to use the same variables as you, I try to fetch a extra.apiEndpoint custom var we defined.

My https://github.com/expo/expo/issues/13513#issuecomment-1237238178 works with that without any hardcoding. I’m using that solution in production too 😃

Indeed, you don’t have value hardcoded on your code. However, what a complex custom logic just for a not provided manifest property. 😕

I think I’ll just be careful of doing a eas upate command just after the eas build to be sure the app load the configuration correctly until I do the upgrade to SDK 46.

Thanks for the help! 👍

@isaachinman as I expected, expo-updates (the package) is staying, but the service (free OTA pushes) is going away. The newer (and supposedly better) EAS Update doesn’t expo manifest anymore (by its RFC–based spec/design).

This is what I’ve started doing:

yarn add dotenv babel-plugin-transform-inline-environment-variables

Then, edit your babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      'react-native-reanimated/plugin',
      'transform-inline-environment-variables', // <= this was added
    ],
    env: {
      production: {
        plugins: ['react-native-paper/babel'],
      },
    },
  };
};

Next, create app.config.ts, and fill it in:

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

// Load .env into process.env
import dotenv from 'dotenv';
dotenv.config();

function assert(value: string | undefined): string | never {
  if (typeof value === 'string') {
    return value;
  }

  throw new Error('Expected value, but ENV variable is not set');
}

export default ({ config }: ConfigContext): ExpoConfig => ({
  ...config,
  name: assert(process.env.EXPO_NAME),
  description: assert(process.env.EXPO_DESCRIPTION),
  slug: assert(process.env.EXPO_SLUG),
  owner: assert(process.env.EXPO_OWNER),
  // ... more if you want
})

…and create the corresponding .env file:

EXPO_NAME="Your App Name"
EXPO_DESCRIPTION="Your app description"
EXPO_SLUG="your-app-slug"
EXPO_OWNER="user-account-name-on-expo.dev"
# ... more if you want

…and finally create a new file src/config.ts

export const EXPO_SLUG = process.env.EXPO_SLUG!;
export const EXPO_OWNER = process.env.EXPO_OWNER!; 

export const EXPERIENCE_ID = [EXPO_OWNER, EXPO_SLUG].join('/');

It’s not perfect because technically expo could have a different experience ID under the hood, but overall this method works with everything else you need from the manifest, and also shows how you can replace the old "extra" key things.

How does this work?

  • dotenv/config in app.config.ts makes sure process.env is filled with the local .env file (no-op if there is none). This is necessary during local development, or build steps.
  • The babel plugin transform-inline-environment-variables searches for process.env.SOME_KEY and replaces it with the actual value of SOME_KEY during that process. That means that in your build output, the files no longer have any process.env reference.
  • If you push an update over the air, a new config.ts file will be downloaded (with actual values, not process.env references).
  • Rejoice.

@brentvatne

Is there any official documentation on this subject?

It seems the absence of manifest essentially breaks several/many expo packages when upgrading from 45 to 46-dev-client, and I cannot find any official guidance.

Is the workaround listed above seriously what’s still needed, over a year later?

After an upgrade to eas update and Expo v46, I’m back to the originalFullName issue, following https://github.com/expo/expo/issues/13513#issuecomment-1146881040.

The variable to use is now Constants.expoConfig.originalFullName, stop me if I am wrong.

This variable:

  • Is present on eas build output
  • Is present on eas update output usage with Expo Go
  • Is not present when used locally with Expo Go

This variable is supposed to be auto-generated in any circumstance, am I right? Without that value, I have no way to provide a unique id to my notifications service, meaning no way to test notifications locally.

The only workaround I found looks like the original one posted by @SleeplessByte:

// Directly on App.tsx or index.tsx according to your code structure.
import Constants from 'expo-constants';

if (Constants.expoConfig && !Constants.expoConfig.originalFullName) {
  Constants.expoConfig.originalFullName = '@org/project';
}

However, I am not supposed to do that. I am missing something or are we facing an Expo bug here?

Is there any official documentation on this subject? It seems the absence of manifest essentially breaks several/many expo packages when upgrading from 45 to 46-dev-client, and I cannot find any official guidance.

@isaachinman and @soullivaneuh From what I’ve read, either from the Expo docs (on the EAS debugging/troubleshooting something guide) or from Kim on their Discord (link), the way to do things from Expo SDK 46 and onwards, is to use Constants.expoConfig instead of Constants.manifest since that will be null after an update. Here’s the Typescript interface for whomever needs it.

Edit: Constants.expoConfig will handle resolving itself regardless of whether you’re using EAS updates or the classic updates service.

Thanks for raising! While we work to make this smoother I’d recommend using the native option rather than setting originalFullName yourself.

https://docs.expo.io/versions/latest/sdk/auth-session/#authsessionmakeredirecturi https://docs.expo.io/versions/latest/sdk/auth-session/#authsessionredirecturioptions