Description
🔥
Issue
When creating a firebase project, configuring it, adding a billing account, upgrading the plane to Blaz, setting up email/password as a sign-in options, and then enabling password policy (for example, requiring upper/lower characters and numbers), then calling createUserWithEmailAndPassword with a valid email and a password that doesn't follow all the password-policy requirements returns internal-error instead of password-does-not-meet-requirements (I tested the same firebase project with the js firebase package and there I do get password-does-not-meet-requirements).
const handleSignUp = async (
email: string,
password: string,
) => {
if (!email || !password) {
throw new Error("Please enter a valid email and password");
}
const response = await auth.createUserWithEmailAndPassword(email, password);
if (!response || !response.user) {
throw new Error("Something went wrong while creating user");
}
return response.user;
};
handleSignUp(email, password)
.then(() => {
console.debug("Sign up successful! Redirecting to (app)...");
router.replace("/(app)");
})
.catch((error: ReactNativeFirebase.NativeFirebaseError) => {
console.error(error); // prints [auth/internal-error] An internal error has occurred, please try again.
console.error(error.code); // prints auth/internal-error
});
handleSignUp('[email protected]', 'thispassworddoesnthavedigits');
in a plain js project:
import { initializeApp } from 'firebase/app';
import { getAuth, createUserWithEmailAndPassword } from "firebase/auth";
const firebaseConfig = {
...
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const main = async () => {
createUserWithEmailAndPassword(auth, '[email protected]', 'thispassworddoesnthavedigits')
.then((userCredential) => {
console.log('success', userCredential);
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.log('error', errorCode, errorMessage); // prints 'password-does-not-meet-requirements'
});
console.log(auth);
}
main();
I upgraded the project to Blaze as many said it causes similar issues. I re-downloaded both the Android and ios configuration files from the Firebase dashboard, I made sure everything was correct. Everything else works fine - both registration and authentication.
Project Files
Nothing special, just a plain expo project (of course I'm using development builds with expo-dev-client).
Javascript
Click To Expand
package.json
:
{
"name": "...",
"main": "expo-router/entry",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"test": "jest --watchAll",
"lint": "expo lint",
"build-ios": "expo run:ios",
"build-android": "expo run:android"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo-google-fonts/rubik": "^0.2.3",
"@expo/vector-icons": "^14.0.2",
"@react-native-community/datetimepicker": "8.2.0",
"@react-native-firebase/app": "^21.10.1",
"@react-native-firebase/auth": "^21.10.1",
"@react-native-firebase/crashlytics": "^21.10.1",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/native": "^7.0.14",
"expo": "~52.0.33",
"expo-auth-session": "^6.0.3",
"expo-blur": "~14.0.3",
"expo-build-properties": "~0.13.2",
"expo-constants": "~17.0.6",
"expo-dev-client": "~5.0.12",
"expo-haptics": "~14.0.1",
"expo-image": "~2.0.5",
"expo-linking": "~7.0.5",
"expo-localization": "~16.0.1",
"expo-router": "~4.0.17",
"expo-secure-store": "^14.0.1",
"expo-splash-screen": "~0.29.21",
"expo-status-bar": "~2.0.1",
"expo-symbols": "~0.2.2",
"expo-system-ui": "~4.0.8",
"expo-web-browser": "~14.0.2",
"nativewind": "^4.1.23",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.7",
"react-native-gesture-handler": "~2.20.2",
"react-native-keyboard-controller": "^1.16.4",
"react-native-modal-datetime-picker": "^18.0.0",
"react-native-reanimated": "3.16.2",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
"react-native-toast-message": "^2.2.1",
"react-native-web": "~0.19.13",
"react-native-webview": "13.12.5",
"tailwindcss": "^3.4.17"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@types/jest": "^29.5.12",
"@types/react": "~18.3.12",
"babel-plugin-transform-remove-console": "^6.9.4",
"jest": "^29.2.1",
"jest-expo": "~52.0.3",
"typescript": "^5.3.3"
}
}
ios/Podfile
:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
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 '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'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']
platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1'
install! 'cocoapods',
:deterministic_uuids => false
prepare_react_native_project!
target '...' do
use_expo_modules!
if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
else
config_command = [
'node',
'--no-warnings',
'--eval',
'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))',
'react-native-config',
'--json',
'--platform',
'ios'
]
end
config = use_native_modules!(config_command)
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']
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/..",
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
)
post_install do |installer|
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
:ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true',
)
# 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
end
Environment
Click To Expand
- Platform that you're experiencing the issue on:
- iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
react-native-firebase
version you're using that has this issue:21.10.1
Firebase
module(s) you're using that has the issue:auth
- Are you using
TypeScript
?Yes
&5.3.3
- 👉 Check out
React Native Firebase
andInvertase
on Twitter for updates on the library.