EAS Build Failing to get pods compatibility right with IOS on EXPO SDK 48

  1. SDK Version: 48.0.18
  2. Platforms: IOS
    3- Eas-Cli: eas-cli/3.18.3 win32-x64 node-v16.15.1 or macOS node-v18.17
    Using managed workflow when i use eas build -p ios --profile production i get the following error:
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
RNFBAnalytics: Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps.
RNFBAnalytics: You may set variable `$RNFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids.
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`
[!] CocoaPods could not find compatible versions for pod "GTMSessionFetcher/Core":
  In Podfile:
    EXFaceDetector (from `../node_modules/expo-face-detector/ios`) was resolved to 12.1.2, which depends on
      MLKitFaceDetection (= 1.5.0) was resolved to 1.5.0, which depends on
        MLKitVision (~> 3.0) was resolved to 3.0.0, which depends on
          GTMSessionFetcher/Core (~> 1.1)
RNFBAuth (from `../node_modules/@react-native-firebase/auth`) was resolved to 18.3.0, which depends on
      Firebase/Auth (= 10.12.0) was resolved to 10.12.0, which depends on
        FirebaseAuth (~> 10.12.0) was resolved to 10.12.0, which depends on
          GTMSessionFetcher/Core (< 4.0, >= 2.1)

Of course i have searched for it and i found out that most answers go to the podfile.lock file and set the pods for GTMSessionFetcher for each one of these. Thing is im using managed workflow and i when i run the npx expo prebuild --clean command i don’t have any podfile.lock file, i only have the podfile file which has the following content:

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = '1' if podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] == 'true'

platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0'
install! 'cocoapods',
  :deterministic_uuids => false

prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this,
# you can also exclude `react-native-flipper` in `react-native.config.js`
#
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
#   }
# }
# ```
flipper_config = FlipperConfiguration.disabled
if ENV['NO_FLIPPER'] == '1' then
  # Explicitly disabled through environment variables
  flipper_config = FlipperConfiguration.disabled
elsif podfile_properties.key?('ios.flipper') then
  # Configure Flipper in Podfile.properties.json
  if podfile_properties['ios.flipper'] == 'true' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"])
  elsif podfile_properties['ios.flipper'] != 'false' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] })
  end
end

target 'myappDevelopment' do
  use_expo_modules!
  config = use_native_modules!

  use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
  use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
    :flipper_configuration => flipper_config
  )

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # This is necessary for Xcode 14, because it signs resource bundles by default
    # when building for devices.
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end

Also the content of my podfile.properties.json file :

{
  "expo.jsEngine": "hermes",
  "ios.useFrameworks": "static"
}

My package.json file:

{
  "name": "myapp",
  "version": "1.0.0",
  "engines": {
    "node": ">=16.0.0 <=18.17.0"
  },
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo-google-fonts/inter": "^0.2.3",
    "@expo-google-fonts/roboto": "^0.2.3",
    "@expo/webpack-config": "^18.0.1",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/blur": "^4.3.2",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-native-community/netinfo": "9.3.7",
    "@react-native-firebase/analytics": "^18.1.0",
    "@react-native-firebase/app": "^18.1.0",
    "@react-native-firebase/auth": "^18.1.0",
    "@react-native-firebase/firestore": "^18.1.0",
    "@react-native-firebase/messaging": "^18.1.0",
    "@react-native-masked-view/masked-view": "0.2.8",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/drawer": "^6.6.2",
    "@react-navigation/elements": "^1.3.17",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@react-navigation/stack": "^6.3.16",
    "@reduxjs/toolkit": "^1.9.3",
    "amazon-cognito-identity-js": "^6.1.2",
    "aws-amplify": "^5.1.3",
    "axios": "^1.4.0",
    "babel-plugin-dotenv-import": "^3.0.1",
    "expo": "~48.0.18",
    "expo-application": "~5.1.1",
    "expo-asset": "~8.9.1",
    "expo-av": "~13.2.1",
    "expo-background-fetch": "~11.1.1",
    "expo-barcode-scanner": "~12.3.2",
    "expo-blur": "~12.2.2",
    "expo-build-properties": "~0.6.0",
    "expo-camera": "~13.2.1",
    "expo-crypto": "~12.2.1",
    "expo-dev-client": "~2.2.1",
    "expo-face-detector": "~12.1.1",
    "expo-file-system": "~15.2.2",
    "expo-font": "~11.1.1",
    "expo-linear-gradient": "~12.1.2",
    "expo-linking": "~4.0.1",
    "expo-location": "~15.1.1",
    "expo-media-library": "~15.2.3",
    "expo-screen-orientation": "~5.1.1",
    "expo-secure-store": "~12.1.1",
    "expo-splash-screen": "~0.18.2",
    "expo-status-bar": "~1.4.4",
    "expo-system-ui": "~2.2.1",
    "expo-task-manager": "~11.1.1",
    "expo-updates": "~0.16.4",
    "expo-web-browser": "~12.1.1",
    "galio-framework": "^0.8.0",
    "patch-package": "^6.5.1",
    "react": "18.2.0",
    "react-native": "0.71.8",
    "react-native-animatable": "^1.3.3",
    "react-native-autocomplete-dropdown": "^2.1.0",
    "react-native-countdown-circle-timer": "^3.2.1",
    "react-native-dialog": "^9.3.0",
    "react-native-dotenv": "^3.4.8",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-maps": "1.3.2",
    "react-native-modal-datetime-picker": "^14.0.1",
    "react-native-modal-dropdown": "^1.0.2",
    "react-native-otp-verify": "^1.1.4",
    "react-native-paper": "^5.8.0",
    "react-native-progress": "^5.0.0",
    "react-native-qrcode-svg": "^6.2.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-root-siblings": "^4.1.1",
    "react-native-root-toast": "^3.4.1",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-signature-canvas": "^4.5.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "13.4.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.10",
    "react-native-webview": "11.26.0",
    "react-redux": "^8.0.5",
    "redux": "^4.2.1",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.2",
    "expo-image": "~1.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "babel-preset-expo": "^9.3.0"
  },
  "private": true
}

I’m also using dynamic config with app.config.js:

const commonConfig = {
  slug: "myapp",
  scheme: "myapp",
  version: "1.0.00",
  orientation: "portrait",
  owner: "myself",
  icon: "./assets/favicon.png",
  userInterfaceStyle: "automatic",
  splash: {
    image: "./assets/splash.png",
    resizeMode: "cover",
    backgroundColor: "#46CCD1",
  },
  plugins: [
    [
      "expo-build-properties",
      {
        android: {
          config: {
            googleMaps: {
              apiKey: process.env.GOOGLE_MAPS_API_KEY_ANDROID,
            },
            googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY_ANDROID,
            minSdkVersion: 25,
            package: "myapp",
          },
        },
        ios: {
          useFrameworks: "static",
          bundleIdentifier: "myapp",
          usesNonExemptEncryption: false,
        },
      },
    ],
    "@react-native-firebase/app",
    "@react-native-firebase/auth",
  ],
  runtimeVersion: {
    policy: "sdkVersion",
  },
  assetBundlePatterns: ["assets/images/*"],
  ios: {
    supportsTablet: true,
    bundleIdentifier: "myapp",
    googleServicesFile: process.env.GOOGLE_SERVICES_PLIST || "./GoogleService-info.plist",
    config: {
      usesNonExemptEncryption: false,
      googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY_IOS,
    },
    buildNumber: "18",
  },
  web: {
    favicon: "./assets/favicon.png",
  },
  updates: {
    url: process.env.EXPO_UPDATES_URL,
  },
  android: {
    versionCode: 1,
    package: "mypackage",
    googleServicesFile: process.env.GOOGLE_SERVICES_JSON || "./google-services.json",
    config: {
      googleMaps: {
        apiKey: process.env.GOOGLE_MAPS_API_KEY_ANDROID,
      },
    },
  },
};

I have tried using build with --clear-cache flag, also tried many solutions i found online (Using a plugin, trying to modify the pods manually, using patch-package to fix node-modules) but i seem to fail to understand something.
I am really stuck on this because even changing packages versions or upgrading to expo sdk 49 does not seem to fix the issue. Any workarounds? I’d love to keep using the managed workflow(that does not use the ios/android folders) but i seem to not have any options except ejecting.