Skip to content
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

SDK 48.0.0 - Android APK Local Build - Expo constants are undefined #2077

Closed
Meronkha opened this issue Oct 6, 2023 · 3 comments
Closed
Assignees

Comments

@Meronkha
Copy link

Meronkha commented Oct 6, 2023

Summary

Hi folks, hope you're all doing well.

I'm encountering a strange issue when trying to build an APK.

Expo constants seem to be undefined in a built APK but works for iOS build, android simulator and iOS simulator.

Running expo SDK48

The following is my extra config inside app.config.js:

extra: {
  firebaseApiKey: process.env.FIREBASE_API_KEY,
  firebaseAuthDomain: process.env.FIREBASE_AUTH_DOMAIN,
  firebaseDatabaseURL: process.env.FIREBASE_DATABASE_URL,
  firebaseProjectId: process.env.FIREBASE_PROJECT_ID,
  firebaseStorageBucket: process.env.FIREBASE_STORAGE_BUCKET,
  firebaseMessagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
  firebaseAppId: process.env.FIREBASE_APP_ID,
  firebaseMeasurementId: process.env.FIREBASE_MEASUREMENT_ID,
  iosGoogleClientId: process.env.IOS_GOOGLE_CLIENT_ID,
  androidClientId: process.env.ANDROID_CLIENT_ID,
  webGoogleClientId: process.env.WEB_GOOGLE_CLIENT_ID,
  googlePlacesApi: process.env.GOOGLE_PLACES_API_KEY,
  eas: {
    projectId: "my-project-id",
  },

When attempting to access the constants in my .firebaseConfig file:

const firebaseConfig = {
  apiKey: Constants.expoConfig.extra.firebaseApiKey,
  authDomain: Constants.expoConfig.extra.firebaseAuthDomain,
  databaseURL: Constants.expoConfig.extra.firebaseDatabaseURL,
  projectId: Constants.expoConfig.extra.firebaseProjectId,
  storageBucket: Constants.expoConfig.extra.firebaseStorageBucket,
  messagingSenderId: Constants.expoConfig.extra.firebaseMessagingSenderId,
  appId: Constants.expoConfig.extra.firebaseAppId,
  measurementId: Constants.expoConfig.extra.firebaseMeasurementId,
}

they are all evaluating to undefined.

The following is my build config in eas.json:

  "preview": {
    "distribution": "internal",
    "channel": "preview",
    "android": {
      "buildType": "apk"
    },
    "ios": { "simulator": false }
  },

Build command
eas build -p android --profile preview --local

After I execute this build command, the [READ_APP_CONFIG] Using app configuration: log produces a config which completely excludes the config I added and only shows:

"extra": {
  "eas": {
    "projectId": "my-project-id"
  }
},

Interestingly, when I run expo config --type public, it does indeed display the correct config.

Any thoughts/advice on the matter would be appreciated.

Managed or bare?

Bare

Environment

expo-env-info 1.0.5 environment info:
  System:
    OS: macOS 13.3
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.0 - ~/.asdf/installs/nodejs/16.20.0/bin/node
    npm: 8.19.4 - ~/.asdf/plugins/nodejs/shims/npm
  Managers:
    CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.10811636
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  npmPackages:
    @expo/webpack-config: ^18.0.1 => 18.1.0
    expo: ~48.0.18 => 48.0.19
    react: 18.2.0 => 18.2.0
    react-dom: 18.0.0 => 18.2.0
    react-native: 0.71.13 => 0.71.13
    react-native-web: ~0.18.7 => 0.18.12
  Expo Workflow: bare
    
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

Reproducible demo or steps to reproduce from a blank project

https://github.com/infinitered/ignite

@Meronkha Meronkha added the needs review Issue is ready to be reviewed by a maintainer label Oct 6, 2023
@szdziedzic
Copy link
Member

Hi, I think it can be a bug on our end. I will let you know once it's fixed!

@szdziedzic szdziedzic added issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels Nov 14, 2023
@expo-bot
Copy link
Contributor

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@szdziedzic szdziedzic self-assigned this Nov 14, 2023
@szdziedzic
Copy link
Member

Hi, I think that this should be fixed now, and the Read app config output should now be aligned with the npx expo config --type public output. Let me know if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants