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

Does this library work with Expo SDK 49? #467

Closed
benazir46 opened this issue Oct 16, 2023 Discussed in #465 · 2 comments
Closed

Does this library work with Expo SDK 49? #467

benazir46 opened this issue Oct 16, 2023 Discussed in #465 · 2 comments

Comments

@benazir46
Copy link

Discussed in #465

Originally posted by benazir46 October 14, 2023

Discussed in #465

Originally posted by benazir46 October 14, 2023
I use a private package that uses environment variables. After upgrading to Expo SDK 49 from 48, they are not working properly in standalone builds. I'm accessing env variables like process.env.MY_VARIABLE. It works inside the src folder, but it's not working inside the node_modules folder where my private package lies. Expo SDK 49 supports environment variables starting with the prefix EXPO_PUBLIC_. Expo mentioned it does not change anything inside the node_modules folder for security reasons, so I was hoping this library could help. I have been using this library for the last five years without any trouble till now.

I'm also using Sentry. It needs environment variables too. In Expo SDK 48 I had issues with it: Sentry package wasn't able to access the env vars. The way I got around with was by updating the babel configuration like this:

plugins: [ [ 'module:react-native-dotenv', { moduleName: 'react-native-dotenv', path: '.env.custom', allowUndefined: false, }, ], ]


Now it's not working. Could this be due to the eas-cli? My current version is `eas-cli/5.4.0 darwin-x64 node-v16.19.1`

To reproduce this you need to use Sentry and install a private package that uses env variables. Then check the env variable values inside the node_modules folder on the standalone build. Here is my expo environment info:


expo-env-info 1.0.5 environment info:

System:
  OS: macOS 14.0
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
  Yarn: 1.22.19 - ~/.nvm/versions/node/v16.19.1/bin/yarn
  npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
  Watchman: 2023.10.02.00 - /opt/homebrew/bin/watchman
Managers:
  CocoaPods: 1.13.0 - /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode: 15.0/15A240d - /usr/bin/xcodebuild
npmPackages:
  expo: ^49.0.13 => 49.0.13 
  react: 18.2.0 => 18.2.0 
  react-dom: 18.2.0 => 18.2.0 
  react-native: 0.72.5 => 0.72.5 
  react-native-web: ~0.19.6 => 0.19.9 
npmGlobalPackages:
  eas-cli: 5.4.0
Expo Workflow: bare
@github-actions
Copy link

Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/467

@benazir46
Copy link
Author

The issue was I had only Sentry env variables defined in eas.json. From Expo SDK 48.0.21 and above it was used instead of the .env file. After adding all to the eas.json file, everything is working. I'm closing this.

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