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 - 'headerValue()' is unavailable in Swift: Use asyncHeaderValue() async -> String? instead. #8073

Closed
VadymBezsmertnyi opened this issue Oct 21, 2024 · 14 comments
Labels

Comments

@VadymBezsmertnyi
Copy link

VadymBezsmertnyi commented Oct 21, 2024

Good day, I have an error after the last pod update, specifically:
'headerValue()' is unavailable in Swift: Use 'asyncHeaderValue() async -> String?' instead.
This occurs in the file AuthBackend.swift.
I am attaching screenshots:
image
image

Also, here is my package.json:

{
"name": "name",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"repods": "cd ios && pod install",
"reinstall": "rm -rf node_modules/ && yarn cache clean && yarn install && cd ios && rm -rf Podfile.lock && rm -rf Pods && arch -x86_64 pod install",
"icons": "svgr -d assets/icons-auto/components assets/icons-auto/svg --template assets/icons-auto/icon-template.js --typescript --native --no-dimensions",
"android-release-bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/ && rm -rf android/app/src/main/res/drawable-
&& rm -rf android/app/src/main/res/raw/* && cd android && ./gradlew bundleRelease && cd ..",
"android-release-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/ && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && cd android && ./gradlew assembleRelease && cd .."
},
"dependencies": {
"@gorhom/bottom-sheet": "^5.0.4",
"@invertase/react-native-apple-authentication": "^2.4.0",
"@react-native-async-storage/async-storage": "^2.0.0",
"@react-native-community/datetimepicker": "^8.2.0",
"@react-native-community/push-notification-ios": "^1.11.0",
"@react-native-firebase/app": "^21.1.0",
"@react-native-firebase/auth": "^21.1.0",
"@react-native-firebase/database": "^21.1.0",
"@react-native-firebase/messaging": "^21.1.0",
"@react-native-firebase/storage": "^21.1.0",
"@react-native-google-signin/google-signin": "^13.1.0",
"@react-navigation/bottom-tabs": "^6.6.1",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@svgr/cli": "^8.1.0",
"axios": "^1.7.7",
"dayjs": "^1.11.13",
"react": "18.3.1",
"react-native": "0.75.4",
"react-native-contacts": "^7.0.8",
"react-native-fbsdk-next": "^13.1.3",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.20.0",
"react-native-get-random-values": "^1.11.0",
"react-native-global-props": "^1.1.5",
"react-native-image-picker": "^7.1.2",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.8.3",
"react-native-permissions": "^5.0.1",
"react-native-purchases": "^8.2.4",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^3.16.1",
"react-native-safe-area-context": "^4.11.1",
"react-native-screens": "^3.34.0",
"react-native-section-alphabet-list": "^3.0.0",
"react-native-shadow-2": "^7.1.0",
"react-native-share": "^11.0.4",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^15.8.0",
"react-native-text-input-mask": "^3.2.0",
"react-native-vision-camera": "^4.5.3",
"uuid": "^10.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.8",
"@babel/preset-env": "^7.25.8",
"@babel/runtime": "^7.25.7",
"@react-native-community/cli": "^14.1.1",
"@react-native/babel-preset": "0.75.4",
"@react-native/eslint-config": "0.75.4",
"@react-native/metro-config": "0.75.4",
"@react-native/typescript-config": "0.75.4",
"@types/react": "^18.3.11",
"@types/react-native-global-props": "^1.1.6",
"@types/react-native-push-notification": "^8.1.4",
"@types/react-test-renderer": "^18.3.0",
"@types/uuid": "^10.0.0",
"babel-jest": "^29.7.0",
"eslint": "^9.13.0",
"jest": "^29.7.0",
"prettier": "3.3.3",
"react-native-dotenv": "^3.4.11",
"react-test-renderer": "18.3.1",
"typescript": "5.6.3"
},
"engines": {
"node": ">=18"
},
"packageManager": "[email protected]"
}

@Carlosmedina06
Copy link

Carlosmedina06 commented Oct 21, 2024

When I try to generate a build on iOS with EAS, I get the same error

package.json
{ "name": "farmatouch", "version": "1.0.0", "scripts": { "start": "expo start --dev-client", "build:develop": "eas build --local --profile development --clear-cache", "android:prod": "NODE_ENV=production expo start --android", "ios:prod": "NODE_ENV=production expo start --ios", "web": "expo start --web", "lint": "eslint \"**/*.{ts,tsx}\" --quiet --color", "lint:fix": "eslint \"**/*.{ts,tsx}\" --quiet --color --fix", "prepare": "husky", "build:icons": "node scripts/generate-font-icon.js && node scripts/generate-misc-icons.js", "build:openapi": "node scripts/build-openapi.js", "postinstall": "patch-package", "test": "jest --watch --coverage=false --changedSince=origin/main", "test:silent": "jest --ci" }, "dependencies": { "@gorhom/portal": "^1.0.14", "@microsoft/signalr": "6.0.25", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-community/geolocation": "^3.3.0", "@react-native-community/hooks": "^3.0.0", "@react-native-firebase/app": "^21.1.0", "@react-native-firebase/auth": "^21.1.0", "@react-native-firebase/messaging": "^21.1.0", "@react-native-firebase/remote-config": "^21.1.0", "@react-native-google-signin/google-signin": "^13.1.0", "@react-navigation/bottom-tabs": "^6.6.1", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@reduxjs/toolkit": "^2.2.4", "@sentry/react-native": "^5.31.1", "@shopify/react-native-skia": "1.2.3", "@tamagui/animate-presence": "1.100.3", "@tamagui/animations-moti": "1.100.3", "@tamagui/core": "1.100.3", "@uidotdev/usehooks": "^2.4.1", "axios": "^1.6.8", "base-64": "^1.0.0", "credit-card-type": "^10.0.1", "date-fns": "^4.1.0", "expo": "~51.0.12", "expo-build-properties": "~0.12.5", "expo-clipboard": "~6.0.3", "expo-constants": "~16.0.2", "expo-dev-client": "~4.0.22", "expo-device": "~6.0.2", "expo-document-picker": "~12.0.2", "expo-file-system": "~17.0.1", "expo-font": "~12.0.5", "expo-image-manipulator": "~12.0.5", "expo-image-picker": "~15.0.7", "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", "expo-location": "~17.0.1", "expo-notifications": "~0.28.7", "expo-splash-screen": "~0.27.5", "expo-status-bar": "~1.12.1", "expo-updates": "~0.25.22", "expo-web-browser": "^13.0.3", "i18next": "^23.11.5", "jotai": "^2.8.0", "jwt-decode": "^4.0.0", "lodash": "^4.17.21", "lottie-react-native": "6.7.0", "millify": "^6.1.0", "mixpanel-react-native": "^3.0.5", "moti": "0.29.0", "pdf-lib": "^1.17.1", "react": "18.2.0", "react-dom": "18.2.0", "react-i18next": "^14.1.2", "react-native": "0.74.5", "react-native-blob-util": "^0.19.11", "react-native-circular-progress": "^1.4.0", "react-native-gesture-handler": "~2.16.1", "react-native-google-places-autocomplete": "^2.5.6", "react-native-keyboard-controller": "1.13.1", "react-native-maps": "1.14.0", "react-native-mask-text": "^0.14.2", "react-native-pager-view": "6.3.0", "react-native-paper": "^5.12.5", "react-native-pdf": "^6.7.5", "react-native-reanimated": "~3.10.1", "react-native-reanimated-carousel": "^3.5.1", "react-native-safe-area-context": "4.10.1", "react-native-screens": "3.31.1", "react-native-shadow-2": "^7.1.0", "react-native-step-indicator": "^1.0.3", "react-native-svg": "15.2.0", "react-native-swiper-flatlist": "^3.2.4", "react-native-toast-message": "^2.2.0", "react-native-uuid": "^2.0.2", "react-native-webview": "13.8.6", "react-query": "^3.39.3", "react-query-swagger": "15.12.2", "string-mask": "^0.3.0", "supercluster": "^8.0.1" }, "devDependencies": { "@babel/core": "^7.20.0", "@jest/globals": "^29.7.0", "@tamagui/babel-plugin": "^1.98.1", "@testing-library/jest-dom": "^6.4.5", "@testing-library/jest-native": "^5.4.3", "@testing-library/react-native": "^12.5.1", "@types/base-64": "^1.0.2", "@types/jest": "^29.5.12", "@types/lodash": "^4.17.1", "@types/react": "~18.2.45", "@types/supercluster": "^7.1.3", "@types/uuid": "^10.0.0", "@typescript-eslint/eslint-plugin": "^7.13.0", "@typescript-eslint/parser": "^7.13.0", "babel-plugin-module-resolver": "^5.0.2", "eslint": "^8.37.0", "eslint-config-expo": "^7.0.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.2", "fs": "^0.0.1-security", "glob": "^10.3.15", "husky": "^9.0.11", "jest": "^29.7.0", "jest-expo": "^51.0.2", "openapi-merge": "^1.3.3", "oslllo-svg-fixer": "^4.0.1", "patch-package": "^8.0.0", "prettier": "^3.3.2", "prop-types": "^15.8.1", "react-native-svg-transformer": "^1.4.0", "reactotron-react-native": "^5.1.8", "svg2ttf": "^6.0.3", "svgicons2svgfont": "^12.0.0", "swagger-merger": "^1.5.4", "ts-jest": "^29.1.4", "typescript": "5.3.3", "xml2js": "^0.6.2" }, "private": true, "lint-staged": { "*.{ts,tsx}": [ "npm run lint", "prettier --write", "git add" ], "*.json": [ "prettier --write" ] }, "jest": { "preset": "jest-expo", "setupFilesAfterEnv": [ "./node_modules/react-native-gesture-handler/jestSetup.js", "@testing-library/react-native/extend-expect", "<rootDir>/jest.setup.js" ], "transformIgnorePatterns": [ "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg|@tamagui/.*|moti/.*|kdbush|supercluster|@uidotdev/.*|react-native-keyboard-controller/.*)" ], "moduleNameMapper": { "\\.svg": "<rootDir>/__mocks__/svgMock.js" } } }

Captura de pantalla 2024-10-21 a la(s) 4 04 35 p  m

@DiazIgnacio
Copy link

DiazIgnacio commented Oct 21, 2024

Same issue here, happening when building on EAS server's but not locally

@mikehardy
Copy link
Collaborator

Are you able to reproduce the bug with my build issue reproducer here? https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

just need to plop a google services json/plist file in there and bump the RNFB version to 21.1.0 (though, I've been using firebase-ios-sdk 11.3.0 forever already and it worked...)

I suspect something going on with caching or something, or perhaps the firebase-ios-sdk version is overriden in the Podfile or something?

Because I haven't had any build problems like this either here in the e2e test suite app or my build reproducer 🤔

@PavelShev
Copy link

PavelShev commented Oct 21, 2024

Same errors here in class AuthBackend
'headerValue()' has been explicitly marked unavailable here (FirebaseCoreExtension.FIRHeartbeatLoggerProtocol)
Installing Firebase (11.3.0)
Installing FirebaseAppCheckInterop (11.4.0)
Installing FirebaseAuth (11.3.0)
Installing FirebaseAuthInterop (11.4.0)
Installing FirebaseCore (11.3.0)
Installing FirebaseCoreExtension (11.4.0)
Installing FirebaseCoreInternal (11.4.0)
Installing FirebaseDatabase (11.3.0)
Installing FirebaseInstallations (11.4.0)
Installing FirebaseMessaging (11.3.0)
Installing FirebaseSharedSwift (11.4.0)
Installing FirebaseStorage (11.3.0)

@VadymBezsmertnyi
Copy link
Author

@mikehardy
Hey)
Here are the changes I updated and couldn't revert:
Screenshot 2024-10-22 at 00 11 00

@mikehardy
Copy link
Collaborator

mikehardy commented Oct 21, 2024

I think it's because 11.4.0 came out and we're getting a mix of dependencies - thanks @PavelShev for posting that - very instructive

workaround - pin firebase-ios-sdk in Podfile to 11.4.0 like so: https://rnfirebase.io/#ios

I'm not sure if you can do that in Expo. Looks like we need a release here that can either pin the versions to "same or lower than" firebase-ios-sdk instead of letting them drift since it appears they aren't semantic versioning-safe, or to update to 11.4.0

@DiazIgnacio
Copy link

DiazIgnacio commented Oct 21, 2024

For a managed Expo app I made a temp plugin to solve this:

/* eslint-disable no-undef */
/* eslint-disable quotes */
/* eslint-disable @typescript-eslint/no-var-requires */
const { withDangerousMod } = require('@expo/config-plugins');
const fs = require('fs');
const path = require('path');

const withTempFirebaseFix = (config) => {
    return withDangerousMod(config, [
        'ios',
        (config) => {
            const podfilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');
            let podfileContents = fs.readFileSync(podfilePath, 'utf-8');

            //  Fix for the Podfile
            const fix = `
    # Fix 'headerValue()' is unavailable in Swift: Use asyncHeaderValue() async -> String? 
    # https://github.com/invertase/react-native-firebase/issues/8073
    $FirebaseSDKVersion = '11.4.0'

`;
            if (!podfileContents.includes("$FirebaseSDKVersion = '11.4.0'")) {
                podfileContents = fix + podfileContents;
                fs.writeFileSync(podfilePath, podfileContents);
            }

            return config;
        },
    ]);
};

module.exports = withTempFirebaseFix;

@mikehardy
Copy link
Collaborator

mikehardy commented Oct 22, 2024

I've got a PR in CI right now in #8074 that contrains the transitive dependencies a lot more tightly
Some of them are still slipping out to 11.4.0 but the build passes for me now?

I will also be pursuing the actual firebase-ios-sdk update as a separate item but this should get people building again assuming CI here goes green and I can hit the merge + publish buttons

@mikehardy
Copy link
Collaborator

@DiazIgnacio this is actually a pretty useful plugin in general, as there is no other way I'm aware of to set the Firebase SDK version in Expo since it is direct in the Podfile - thanks for posting that

@maximmai
Copy link

also experiencing this with flutter version 3.24.3 and FirebaseAuth version

#  firebase_analytics: ^10.5.1
#  firebase_auth: ^4.10.1
#  firebase_messaging: ^14.6.9
#  firebase_crashlytics: ^3.3.7
#  firebase_dynamic_links: ^5.3.7
#  firebase_in_app_messaging: ^0.7.3+7

image

@mikehardy
Copy link
Collaborator

v21.1.1 is out with transitive dependencies contained enough that it should work for react-native-firebase folks

https://github.com/invertase/react-native-firebase/blob/main/CHANGELOG.md#2111-2024-10-22

If you have added a version pin, you should probably take it out as soon as possible - it is easy to forget those and they turn into landmines in the future

@maximmai I'm afraid I can't help as this is not the correct repository for that, although I will mention it internally to the Invertase crew as they should be able to have an effect on the flutter plugins. If there is a way to pin your firebase-ios-sdk dependency in the flutter firebase plugins then pinning it to 11.4.0 should fix things for you - but I don't know if there is a mechanism to do so or not - it looks like there might be but I haven't tested it

@VadymBezsmertnyi
Copy link
Author

@mikehardy
Thank you for the quick fix. I updated everything, and it works well)

@mikehardy
Copy link
Collaborator

react-native-firebase with firebase-ios-sdk 11.4.0 is out as well so this should go away for everyone for two reasons:

  • better transitive dependency management so it shouldn't happen again
  • current firebase-ios-sdk so it doesn't matter in this specific instance either

@ncooke3
Copy link

ncooke3 commented Oct 22, 2024

Thanks, @mikehardy! FYI, FirebaseCoreExtension 11.4.1 was published this morning to revert the problematic change. Folks on older Firebase versions that run pod update should get the patched pod.

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

No branches or pull requests

7 participants