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

[Bug]: onesignal-expo-plugin dosen't allow to read EXPO_PUBLIC_ var env #237

Open
jbcrestot opened this issue Sep 1, 2024 · 0 comments
Open

Comments

@jbcrestot
Copy link

What happened?

Hello,

I'm using a managed workflow and building with eas; I'm taking advantage of environment variables of expo (aka EXPO_PUBLIC_*) to change bundler identifier like this :
app.config.ts

const appConfig: AppConfig = {
    bundleIdentifier: process.env.EXPO_PUBLIC_BUNDLER_IDENTIFIER as string
  }

return {
  name: "xxx",
  ios: {
      bundleIdentifier: appConfig.bundleIdentifier,
  }
}

while the build on eas works find, for development we need to start the server and see what happens (I'm logging appConfig for clarity purposes):
APP_VARIANT=development npx expo start --reset-cache

appConfig {
  bundleIdentifier: undefined
}
AssertionError [ERR_ASSERTION]: Missing 'ios.bundleIdentifier' in app config.
error Command failed with exit code 1.

to illustrate more, see what happens when I set the bundler identifier manually :
app.config.ts

return {
  name: "xxx",
  ios: {
      bundleIdentifier: "my.identifier",
  }
}

then start the server :
APP_VARIANT=development npx expo start --reset-cache

appConfig {
  bundleIdentifier: undefined,
}
Starting project at /Users/jb/Projets/mobile
env: load .env.local
env: export EXPO_PUBLIC_BUNDLER_IDENTIFIER [...] EXPO_PUBLIC_ONE_SIGNAL_APP_ID
appConfig {
  bundleIdentifier: 'my.identifier',
}

>>> Then the server starts normally

by the way, I'm doing the same thing for Android but it does not cause the problem.
app.config.ts

android: {
      package: appConfig.bundleIdentifier,
}

Steps to reproduce?

1. npx expo install onesignal-expo-plugin
2. yarn add react-native-onesignal
3. create a file .env and add EXPO_PUBLIC_BUNDLER_IDENTIFIER = com.onsignal.test
4. modify app.config.ts to use it :

return {
  name: "xxx",
  ios: {
      bundleIdentifier: appConfig.bundleIdentifier,
  }
}
  1. npx start start


### What did you expect to happen?

The expo server starts normally

### OneSignal Expo SDK version

"onesignal-expo-plugin": "^2.0.3",
"react-native-onesignal": "^5.2.3",

### Platform

iOS, Android

### Relevant log output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant