invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.6k stars 2.19k forks source link

[πŸ›] Bug Report Title - UseEmulator is ignored and always calls deployed cloud function #6777

Closed R4Y-R4Y closed 1 year ago

R4Y-R4Y commented 1 year ago

Issue

i wanted to test my function locally before i deploy the changes into my function because it seems like deploying costs money when i run npm run serve in my cloud function project, it starts the instance and i see the terminal starting so i try and call the function with react-native-firebase by using the function mentioned in the docs:

import { firebase as funcfb } from '@react-native-firebase/functions';
funcfb.functions().useEmulator('localhost',5001);

so i tried to test it in an Android Emulator and when i call it, it calls the deployed function instead of the local function which will not make me test it properly

Describe your issue here


Project Files

Javascript

import { firebase as funcfb } from '@react-native-firebase/functions';
const App = () => {
   funcfb.functions().useEmulator('localhost',5001);
   async function callFunction() {
        const {data} = await funcfb.functions().httpsCallable('model')({input: features})
    }
}
Click To Expand

#### `package.json`: ```json { "name": "", "version": "0.1.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start --dev-client", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "@babel/runtime": "^7.19.4", "@expo/metro-config": "^0.5.1", "@expo/vector-icons": "^13.0.0", "@freakycoder/react-native-bounceable": "^1.0.3", "@react-native-async-storage/async-storage": "~1.17.3", "@react-native-community/masked-view": "*", "@react-native-community/netinfo": "9.3.0", "@react-native-firebase/analytics": "16.4.6", "@react-native-firebase/app": "16.4.6", "@react-native-firebase/auth": "16.4.6", "@react-native-firebase/crashlytics": "16.4.6", "@react-native-firebase/firestore": "16.4.6", "@react-native-firebase/functions": "16.4.6", "@react-native-firebase/perf": "16.4.6", "@react-native-firebase/storage": "16.4.6", "@react-native-google-signin/google-signin": "^8.0.0", "@react-navigation/bottom-tabs": "^6.4.0", "@react-navigation/drawer": "^6.4.4", "@react-navigation/material-bottom-tabs": "^6.2.4", "@react-navigation/material-top-tabs": "^6.2.4", "@react-navigation/native": "^6.0.12", "@react-navigation/native-stack": "^6.9.0", "abort-controller": "3.0.0", "abs-svg-path": "0.1.1", "absolute-path": "0.0.0", "accepts": "1.3.8", "aggregate-error": "3.1.0", "anser": "1.4.10", "ansi-escapes": "3.2.0", "ansi-fragments": "0.2.1", "ansi-regex": "5.0.1", "ansi-styles": "3.2.1", "any-promise": "1.3.0", "anymatch": "3.1.2", "appdirsjs": "1.2.7", "application-config-path": "0.1.0", "arg": "4.1.0", "argparse": "1.0.10", "arr-diff": "4.0.0", "arr-flatten": "1.1.0", "arr-union": "3.1.0", "array-back": "1.0.4", "array-union": "2.1.0", "array-unique": "0.3.2", "asap": "2.0.6", "assign-symbols": "1.0.0", "ast-types": "0.14.2", "astral-regex": "1.0.0", "async": "3.2.4", "async-limiter": "1.0.1", "asynckit": "0.4.0", "at-least-node": "1.0.0", "atob": "2.1.2", "axios": "0.26.0", "babel-core": "7.0.0-bridge.0", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-module-resolver": "4.1.0", "babel-plugin-polyfill-corejs2": "0.3.2", "babel-plugin-polyfill-corejs3": "0.5.3", "babel-plugin-polyfill-regenerator": "0.4.0", "babel-plugin-react-native-web": "0.18.9", "babel-plugin-syntax-trailing-function-commas": "7.0.0-beta.0", "babel-plugin-transform-inline-environment-variables": "0.0.2", "babel-preset-expo": "9.2.0", "babel-preset-fbjs": "3.4.0", "balanced-match": "1.0.2", "base": "0.11.2", "base-64": "1.0.0", "base64-js": "1.5.1", "better-opn": "3.0.2", "big-integer": "1.6.51", "bl": "4.1.0", "blueimp-md5": "2.19.0", "body-parser": "1.19.0", "bower": "1.8.14", "bower-auto-release": "1.1.358", "bowser": "2.11.0", "bplist-creator": "0.1.0", "bplist-parser": "0.3.2", "brace-expansion": "1.1.11", "braces": "3.0.2", "browserslist": "4.21.3", "bser": "2.1.1", "buffer": "5.7.1", "buffer-alloc": "1.2.0", "buffer-alloc-unsafe": "1.1.0", "buffer-fill": "1.0.0", "buffer-from": "1.1.2", "builtins": "1.0.3", "bytes": "3.1.0", "cacache": "15.3.0", "cache-base": "1.0.1", "call-bind": "1.0.2", "caller-callsite": "2.0.0", "caller-path": "2.0.0", "callsites": "2.0.0", "camelcase": "6.3.0", "camelcase-keys": "6.2.2", "caniuse-lite": "1.0.30001390", "chalk": "2.4.2", "charenc": "0.0.2", "chownr": "2.0.0", "ci-info": "3.3.2", "class-utils": "0.3.6", "clean-stack": "2.2.0", "cli-cursor": "2.1.0", "cli-spinners": "2.7.0", "cliui": "6.0.0", "clone": "2.1.2", "clone-deep": "4.0.1", "collection-visit": "1.0.0", "color": "4.2.3", "color-convert": "1.9.3", "color-name": "1.1.3", "color-string": "1.9.1", "colorette": "1.4.0", "combined-stream": "1.0.8", "command-exists": "1.2.9", "command-line-args": "3.0.5", "commander": "7.2.0", "commondir": "1.0.1", "commons-validator-js": "1.0.1668", "compare-versions": "3.6.0", "component-emitter": "1.3.0", "component-type": "1.2.1", "compressible": "2.0.18", "compression": "1.7.4", "concat-map": "0.0.1", "connect": "3.7.0", "content-type": "1.0.4", "convert-source-map": "1.8.0", "cookie": "0.4.2", "copy-descriptor": "0.1.1", "core-js-compat": "3.25.0", "core-util-is": "1.0.3", "cosmiconfig": "5.2.1", "cross-fetch": "3.1.5", "cross-spawn": "6.0.5", "crypt": "0.0.2", "crypto-js": "4.1.1", "crypto-random-string": "2.0.0", "dag-map": "1.0.2", "dayjs": "1.11.5", "debug": "4.3.4", "decamelize": "1.2.0", "decode-uri-component": "0.2.0", "deep-extend": "0.6.0", "deepmerge": "3.3.0", "default-gateway": "4.2.0", "defaults": "1.0.3", "define-lazy-prop": "2.0.0", "define-properties": "1.1.4", "define-property": "2.0.2", "del": "6.1.1", "delayed-stream": "1.0.0", "denodeify": "1.2.1", "depd": "1.1.2", "deprecated-react-native-prop-types": "2.3.0", "destroy": "1.2.0", "dir-glob": "3.0.1", "ee-first": "1.1.1", "electron-to-chromium": "1.4.242", "emoji-regex": "8.0.0", "encodeurl": "1.0.2", "end-of-stream": "1.4.4", "entities": "2.2.0", "env-editor": "0.4.2", "envinfo": "7.8.1", "eol": "0.9.1", "error-ex": "1.3.2", "error-stack-parser": "2.1.4", "errorhandler": "1.5.1", "escalade": "3.1.1", "escape-html": "1.0.3", "escape-string-regexp": "1.0.5", "esprima": "4.0.1", "esutils": "2.0.3", "etag": "1.8.1", "event-target-shim": "5.0.1", "events": "3.3.0", "exec-async": "2.2.0", "execa": "1.0.0", "expand-brackets": "2.1.4", "expo": "46.0.10", "expo-application": "^4.2.2", "expo-asset": "8.6.1", "expo-auth-session": "3.7.1", "expo-blur": "11.2.0", "expo-build-properties": "^0.3.0", "expo-constants": "13.2.4", "expo-dev-client": "~1.3.1", "expo-dev-launcher": "1.2.1", "expo-dev-menu": "1.2.1", "expo-dev-menu-interface": "0.7.2", "expo-eas-client": "0.3.0", "expo-error-recovery": "3.2.0", "expo-file-system": "14.1.0", "expo-font": "~10.2.0", "expo-image-picker": "~13.3.1", "expo-json-utils": "0.3.0", "expo-keep-awake": "10.2.0", "expo-manifests": "0.3.1", "expo-modules-autolinking": "0.10.3", "expo-modules-core": "~0.11.9", "expo-random": "^12.3.0", "expo-splash-screen": "~0.16.2", "expo-status-bar": "1.4.0", "expo-structured-headers": "2.2.1", "expo-updates": "~0.14.7", "expo-updates-interface": "0.7.0", "expo-web-browser": "^11.0.0", "extend-shallow": "3.0.2", "extglob": "2.0.4", "fast-base64-decode": "1.0.0", "fast-deep-equal": "3.1.3", "fast-glob": "3.2.11", "fast-xml-parser": "3.21.1", "fastq": "1.13.0", "fb-watchman": "2.0.1", "fbemitter": "3.0.0", "fbjs": "3.0.4", "fbjs-css-vars": "1.0.2", "feature-detect-es6": "1.5.0", "fetch-retry": "4.1.1", "fflate": "0.7.3", "fill-range": "7.0.1", "filter-obj": "1.1.0", "finalhandler": "1.1.2", "find-babel-config": "1.2.0", "find-cache-dir": "2.1.0", "find-replace": "1.0.3", "find-up": "5.0.0", "find-yarn-workspace-root": "2.0.0", "flow-parser": "0.121.0", "follow-redirects": "1.15.1", "fontfaceobserver": "2.3.0", "for-in": "1.0.2", "form-data": "3.0.1", "formik": "2.2.9", "fragment-cache": "0.2.1", "freeport-async": "2.0.0", "fresh": "0.5.2", "fs-extra": "8.1.0", "fs-minipass": "2.1.0", "fs.realpath": "1.0.0", "function-bind": "1.1.1", "gensync": "1.0.0-beta.2", "get-caller-file": "2.0.5", "get-intrinsic": "1.1.2", "get-port": "3.2.0", "get-stream": "4.1.0", "get-value": "2.0.6", "getenv": "1.0.0", "glob": "7.1.6", "glob-parent": "5.1.2", "globals": "11.12.0", "globby": "11.1.0", "graceful-fs": "4.2.10", "has": "1.0.3", "has-flag": "3.0.0", "has-property-descriptors": "1.0.0", "has-symbols": "1.0.3", "has-value": "1.0.0", "has-values": "1.0.0", "hermes-engine": "0.11.0", "hermes-estree": "0.6.0", "hermes-parser": "0.6.0", "hermes-profile-transformer": "0.0.6", "hoist-non-react-statics": "3.3.2", "hosted-git-info": "3.0.8", "http-errors": "1.7.2", "iconv-lite": "0.4.24", "idb": "5.0.6", "ieee754": "1.2.1", "ignore": "5.2.0", "image-size": "0.6.3", "immer": "9.0.6", "import-fresh": "2.0.0", "imurmurhash": "0.1.4", "indent-string": "4.0.0", "infer-owner": "1.0.4", "inflight": "1.0.6", "inherits": "2.0.4", "ini": "1.3.8", "internal-ip": "4.3.0", "invariant": "2.2.4", "ip": "1.1.8", "ip-regex": "2.1.0", "ipaddr.js": "1.9.1", "is-accessor-descriptor": "1.0.0", "is-arrayish": "0.2.1", "is-buffer": "1.1.6", "is-core-module": "2.10.0", "is-data-descriptor": "1.0.0", "is-descriptor": "1.0.2", "is-directory": "0.3.1", "is-docker": "2.2.1", "is-extendable": "1.0.1", "is-extglob": "2.1.1", "is-fullwidth-code-point": "2.0.0", "is-glob": "4.0.3", "is-interactive": "1.0.0", "is-invalid-path": "0.1.0", "is-number": "7.0.0", "is-path-cwd": "2.2.0", "is-path-inside": "3.0.3", "is-plain-obj": "2.1.0", "is-plain-object": "2.0.4", "is-root": "2.1.0", "is-stream": "1.1.0", "is-unicode-supported": "0.1.0", "is-valid-path": "0.1.1", "is-windows": "1.0.2", "is-wsl": "2.2.0", "isarray": "1.0.0", "isexe": "2.0.0", "isobject": "3.0.1", "isomorphic-unfetch": "3.1.0", "iterall": "1.3.0", "jest-get-type": "26.3.0", "jest-haste-map": "27.5.1", "jest-regex-util": "27.5.1", "jest-serializer": "27.5.1", "jest-util": "27.5.1", "jest-validate": "26.6.2", "jest-worker": "27.5.1", "jetifier": "1.6.8", "jimp-compact": "0.16.1", "joi": "17.6.0", "join-component": "1.1.0", "js-cookie": "2.2.1", "js-tokens": "4.0.0", "js-yaml": "3.14.1", "jsc-android": "250230.2.1", "jscodeshift": "0.13.1", "jsesc": "2.5.2", "json-parse-better-errors": "1.0.2", "json-schema-deref-sync": "0.13.0", "json5": "2.2.1", "jsonfile": "4.0.0", "kind-of": "6.0.3", "klaw": "1.3.1", "kleur": "3.0.3", "leven": "3.1.0", "lines-and-columns": "1.2.4", "locate-path": "6.0.0", "lodash": "4.17.21", "lodash-es": "4.17.21", "lodash.debounce": "4.0.8", "lodash.includes": "4.3.0", "lodash.isequal": "4.5.0", "lodash.throttle": "4.1.1", "log-symbols": "2.2.0", "logkitty": "0.7.1", "loose-envify": "1.4.0", "lru-cache": "6.0.0", "make-dir": "2.1.0", "makeerror": "1.0.12", "map-cache": "0.2.2", "map-obj": "4.3.0", "map-visit": "1.0.0", "md5": "2.3.0", "md5-file": "3.2.3", "md5hex": "1.0.0", "media-typer": "0.3.0", "memoize-one": "5.2.1", "memory-cache": "0.2.0", "merge-options": "3.0.4", "merge-stream": "2.0.0", "merge2": "1.4.1", "metro": "0.70.3", "metro-babel-transformer": "0.70.3", "metro-cache": "0.70.3", "metro-cache-key": "0.70.3", "metro-config": "0.70.3", "metro-core": "0.70.3", "metro-hermes-compiler": "0.70.3", "metro-inspector-proxy": "0.70.3", "metro-minify-uglify": "0.70.3", "metro-react-native-babel-preset": "0.70.3", "metro-react-native-babel-transformer": "0.70.3", "metro-resolver": "0.70.3", "metro-runtime": "0.70.3", "metro-source-map": "0.70.3", "metro-symbolicate": "0.70.3", "metro-transform-plugins": "0.70.3", "metro-transform-worker": "0.70.3", "micromatch": "4.0.5", "mime": "2.6.0", "mime-db": "1.52.0", "mime-types": "2.1.35", "mimic-fn": "1.2.0", "minimatch": "3.1.2", "minimist": "1.2.6", "minipass": "3.1.6", "minipass-collect": "1.0.2", "minipass-flush": "1.0.5", "minipass-pipeline": "1.2.4", "minizlib": "2.1.2", "mixin-deep": "1.3.2", "mkdirp": "0.5.6", "moment": "2.29.4", "ms": "2.1.2", "mv": "2.1.1", "mz": "2.7.0", "nanoid": "3.3.4", "nanomatch": "1.2.13", "ncp": "2.0.0", "negotiator": "0.6.3", "neo-async": "2.6.2", "nested-error-stacks": "2.0.1", "nice-try": "1.0.5", "nocache": "3.0.4", "node-dir": "0.1.17", "node-fetch": "2.6.7", "node-forge": "1.3.1", "node-int64": "0.4.0", "node-releases": "2.0.6", "node-stream-zip": "1.15.0", "normalize-path": "3.0.0", "normalize-svg-path": "1.1.0", "npm-package-arg": "7.0.0", "npm-run-path": "2.0.2", "nullthrows": "1.1.1", "ob1": "0.70.3", "object-assign": "4.1.1", "object-copy": "0.1.0", "object-keys": "1.1.1", "object-visit": "1.0.1", "object.assign": "4.1.4", "object.pick": "1.3.0", "on-finished": "2.3.0", "on-headers": "1.0.2", "once": "1.4.0", "onetime": "2.0.1", "open": "8.4.0", "ora": "3.4.0", "os-homedir": "1.0.2", "os-tmpdir": "1.0.2", "osenv": "0.1.5", "p-finally": "1.0.0", "p-limit": "3.1.0", "p-locate": "5.0.0", "p-map": "4.0.0", "p-try": "2.2.0", "paho-mqtt": "1.1.0", "pako": "2.0.4", "parse-json": "4.0.0", "parse-png": "2.1.0", "parse-svg-path": "0.1.2", "parseurl": "1.3.3", "pascalcase": "0.1.1", "password-prompt": "1.1.2", "path-browserify": "1.0.1", "path-exists": "3.0.0", "path-is-absolute": "1.0.1", "path-key": "2.0.1", "path-parse": "1.0.7", "path-type": "4.0.0", "picocolors": "1.0.0", "picomatch": "2.3.1", "pify": "4.0.1", "pirates": "4.0.5", "pkg-dir": "3.0.0", "pkg-up": "3.1.0", "plist": "3.0.6", "pngjs": "3.4.0", "posix-character-classes": "0.1.1", "pretty-bytes": "5.6.0", "pretty-format": "26.6.2", "process-nextick-args": "2.0.1", "progress": "2.0.3", "promise": "7.3.1", "promise-inflight": "1.0.1", "prompts": "2.4.2", "prop-types": "15.8.1", "pump": "3.0.0", "punycode": "1.3.2", "qrcode-terminal": "0.11.0", "qs": "6.7.0", "query-string": "7.1.1", "querystring": "0.2.0", "querystringify": "2.2.0", "queue-microtask": "1.2.3", "quick-lru": "4.0.1", "range-parser": "1.2.1", "raw-body": "2.4.0", "rc": "1.2.8", "react": "18.0.0", "react-devtools-core": "4.24.0", "react-fast-compare": "2.0.4", "react-freeze": "1.0.3", "react-is": "17.0.2", "react-native": "0.69.6", "react-native-animated-spinkit": "1.5.2", "react-native-chart-kit": "^6.12.0", "react-native-codegen": "0.69.2", "react-native-color": "0.0.10", "react-native-country-codes-picker": "^2.1.8", "react-native-expo-image-cache": "^4.1.0", "react-native-gesture-handler": "2.5.0", "react-native-get-random-values": "1.8.0", "react-native-gradle-plugin": "0.0.7", "react-native-iphone-x-helper": "1.3.1", "react-native-modalize": "^2.1.1", "react-native-pager-view": "5.4.24", "react-native-paper": "4.12.4", "react-native-profile-picture": "1.0.0", "react-native-reanimated": "2.13.0", "react-native-redash": "12.6.1", "react-native-safe-area-context": "4.3.1", "react-native-screens": "3.15.0", "react-native-slider": "0.11.0", "react-native-spinkit": "1.5.1", "react-native-svg": "12.3.0", "react-native-svg-transformer": "^1.0.0", "react-native-tab-view": "^3.2.1", "react-native-text-size": "4.0.0-rc.1", "react-native-vector-icons": "9.2.0", "react-refresh": "0.4.3", "react-shallow-renderer": "16.15.0", "readable-stream": "2.3.7", "readline": "1.3.0", "recast": "0.20.5", "regenerate": "1.4.2", "regenerate-unicode-properties": "10.0.1", "regenerator-runtime": "0.13.9", "regenerator-transform": "0.15.0", "regex-not": "1.0.2", "regexpu-core": "5.1.0", "regjsgen": "0.6.0", "regjsparser": "0.8.4", "remove-trailing-slash": "0.1.1", "repeat-element": "1.1.4", "repeat-string": "1.6.1", "require-directory": "2.1.1", "require-from-string": "2.0.2", "require-main-filename": "2.0.0", "requireg": "0.2.2", "requires-port": "1.0.0", "reselect": "4.1.6", "resolve": "1.22.1", "resolve-from": "5.0.0", "resolve-url": "0.2.1", "restore-cursor": "2.0.0", "ret": "0.1.15", "reusify": "1.0.4", "rimraf": "2.7.1", "rn-placeholder": "^3.0.3", "run-parallel": "1.2.0", "safe-buffer": "5.1.2", "safe-json-stringify": "1.2.0", "safe-regex": "1.1.0", "safer-buffer": "2.1.2", "sax": "1.2.4", "scheduler": "0.21.0", "semver": "6.3.0", "send": "0.18.0", "serialize-error": "6.0.0", "serve-static": "1.15.0", "set-blocking": "2.0.0", "set-value": "2.0.1", "setimmediate": "1.0.5", "setprototypeof": "1.1.1", "shallow-clone": "3.0.1", "shebang-command": "1.2.0", "shebang-regex": "1.0.0", "shell-quote": "1.7.3", "signal-exit": "3.0.7", "simple-plist": "1.3.1", "simple-swizzle": "0.2.2", "sisteransi": "1.0.5", "slash": "3.0.0", "slice-ansi": "2.1.0", "slugify": "1.6.5", "snapdragon": "0.8.2", "snapdragon-node": "2.1.1", "snapdragon-util": "3.0.1", "source-map": "0.7.4", "source-map-resolve": "0.5.3", "source-map-support": "0.5.21", "source-map-url": "0.4.1", "split": "1.0.1", "split-on-first": "1.1.0", "split-string": "3.1.0", "sprintf-js": "1.0.3", "ssri": "8.0.1", "stackframe": "1.3.4", "stacktrace-parser": "0.1.10", "static-extend": "0.1.2", "statuses": "1.5.0", "stream-buffers": "2.2.0", "strict-uri-encode": "2.0.0", "string_decoder": "1.1.1", "string-hash-64": "1.0.3", "string-width": "4.2.3", "strip-ansi": "5.2.0", "strip-eof": "1.0.0", "strip-final-newline": "2.0.0", "strip-json-comments": "2.0.1", "strnum": "1.0.5", "structured-headers": "0.4.1", "sucrase": "3.25.0", "sudo-prompt": "8.2.5", "supports-color": "5.5.0", "supports-hyperlinks": "2.3.0", "supports-preserve-symlinks-flag": "1.0.0", "svg-arc-to-cubic-bezier": "3.2.0", "tar": "6.1.11", "temp": "0.8.3", "temp-dir": "2.0.0", "tempy": "0.7.1", "terminal-link": "2.1.1", "test-value": "2.1.0", "text-table": "0.2.0", "thenify": "3.3.1", "thenify-all": "1.6.0", "throat": "5.0.0", "through": "2.3.8", "through2": "2.0.5", "tiny-warning": "1.0.3", "tinycolor2": "1.4.2", "tmp": "0.0.33", "tmpl": "1.0.5", "to-fast-properties": "2.0.0", "to-object-path": "0.3.0", "to-regex": "3.0.2", "to-regex-range": "5.0.1", "toidentifier": "1.0.0", "tr46": "0.0.3", "traverse": "0.6.6", "ts-interface-checker": "0.1.13", "tslib": "1.14.1", "type-fest": "0.12.0", "type-is": "1.6.18", "typical": "2.6.1", "ua-parser-js": "0.7.31", "uglify-es": "3.3.9", "ulid": "2.3.0", "unfetch": "4.2.0", "unicode-canonical-property-names-ecmascript": "2.0.0", "unicode-match-property-ecmascript": "2.0.0", "unicode-match-property-value-ecmascript": "2.0.0", "unicode-property-aliases-ecmascript": "2.0.0", "union-value": "1.0.1", "unique-filename": "1.1.1", "unique-slug": "2.0.2", "unique-string": "2.0.0", "universal-cookie": "4.0.4", "universalify": "0.1.2", "unpipe": "1.0.0", "unset-value": "1.0.0", "update-browserslist-db": "1.0.7", "urix": "0.1.0", "url": "0.11.0", "url-join": "4.0.0", "url-parse": "1.5.10", "use": "3.1.1", "use-latest-callback": "0.1.5", "use-memo-one": "1.1.3", "use-sync-external-store": "1.2.0", "util-deprecate": "1.0.2", "utils-merge": "1.0.1", "uuid": "^3.4.0", "valid-url": "1.0.9", "validate-npm-package-name": "3.0.0", "vary": "1.1.2", "vlq": "1.0.1", "walker": "1.0.8", "warn-once": "0.1.1", "wcwidth": "1.0.1", "webidl-conversions": "3.0.1", "whatwg-fetch": "3.6.2", "whatwg-url": "5.0.0", "which": "1.3.1", "which-module": "2.0.0", "wnpm-ci": "8.0.131", "wonka": "4.0.15", "wrap-ansi": "7.0.0", "wrappy": "1.0.2", "write-file-atomic": "2.4.3", "ws": "6.2.2", "xcode": "3.0.1", "xml2js": "0.4.23", "xmlbuilder": "14.0.0", "xtend": "4.0.2", "y18n": "4.0.3", "yallist": "4.0.0", "yargs": "15.4.1", "yargs-parser": "18.1.3", "yocto-queue": "0.1.0", "yup": "^0.32.11", "zen-observable": "0.8.15", "zen-observable-ts": "0.8.19", "zen-push": "0.2.1" }, "devDependencies": { "@babel/core": "^7.18.6" }, "overrides": { "react": "18.0.0", "react-native": "0.69.6" }, } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` OUTPUT GOES HERE ``` - **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 - [x ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `Cloud Function` - **Are you using `TypeScript`?** - `N`


mikehardy commented 1 year ago

Hmm :thinking: so you set funcfb to useEmulator, but then you call via funcs - that seems wrong?

This will be project-specific though. We definitely definitely use the local functions emulator if configured correctly. I use it all the time and we verify it in our e2e test harness (which I also run frequently), and it works.

R4Y-R4Y commented 1 year ago

Hmm πŸ€” so you set funcfb to useEmulator, but then you call via funcs - that seems wrong?

This will be project-specific though. We definitely definitely use the local functions emulator if configured correctly. I use it all the time and we verify it in our e2e test harness (which I also run frequently), and it works.

sorry there was a typo but yeah it always executes the hosted one instead of the one in the firebase emulator suite what information can i provide that might help to solve the issue?

mikehardy commented 1 year ago

I'm going to have to see some sort of reproduction on this, as mentioned, I do this personally, as a project here for module maintenance we do it in the e2e tests, it works. You can build a scaffolded test via https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh and even grab project files from https://github.com/invertase/react-native-firebase-authentication-example/tree/main/template to make a clean test. In the single / nothing-else-but-it App.js set up the functions emulator and it should work

https://stackoverflow.com/help/minimal-reproducible-example

Otherwise this will be closed as can't reproduce since I see it working when I try

R4Y-R4Y commented 1 year ago

could you tell me how should i properly set it up for android emulator and expo connected physical device for testing? it seems there are multiple ways to do so?

mikehardy commented 1 year ago

I don't use expo, so I'm not sure. But what I expect you need to do if you wish to use the functions emulator on a physical device is to either adb reverse a port from the emulator to the functions emulator port then configure functions to use that, or find the network IP address of your development machine running the emulator, and configure the functions emulator to use that real IP/port combo for your dev machine. I'd go with the real IP style personally.

R4Y-R4Y commented 1 year ago

I don't use expo, so I'm not sure. But what I expect you need to do if you wish to use the functions emulator on a physical device is to either adb reverse a port from the emulator to the functions emulator port then configure functions to use that, or find the network IP address of your development machine running the emulator, and configure the functions emulator to use that real IP/port combo for your dev machine. I'd go with the real IP style personally.

I think it would be cooler if it was explained like that in the docs because its recommends to use localhost which I heard about is wrong because it's basically telling the phone to call itself and not calling the emulator or the actual phone Could you please give an example on how can i write this in code?

mikehardy commented 1 year ago

It's a bit more subtle then you are thinking. Android emulators have no problem receiving FCM so most people (including myself) do development using the emulator. And we have specific localhost -> emulator/host IP address forward remapping for that case so it works out of the box for almost everyone. Like we get about one person that has issues with it a year out of all your users, and you are that user, this year :-). No offense intended. There is a big warning in the log for those that are unaware this happens which has some information on what has happened.

Unfortunately after that, if you want to do something custom then it's open-ended, we can't really recommend anything because people's network environments and networking skill levels are infinitely variable. Are you keen to and able to do port forwards to make things appear local on the android device? Are you good at discovering and want to use your real network IPs? We can't predict it. Not sure what or how to document it

R4Y-R4Y commented 1 year ago

It's a bit more subtle then you are thinking. Android emulators have no problem receiving FCM so most people (including myself) do development using the emulator. And we have specific localhost -> emulator/host IP address forward remapping for that case so it works out of the box for almost everyone. Like we get about one person that has issues with it a year out of all your users, and you are that user, this year :-). No offense intended. There is a big warning in the log for those that are unaware this happens which has some information on what has happened.

Unfortunately after that, if you want to do something custom then it's open-ended, we can't really recommend anything because people's network environments and networking skill levels are infinitely variable. Are you keen to and able to do port forwards to make things appear local on the android device? Are you good at discovering and want to use your real network IPs? We can't predict it. Not sure what or how to document it

wish if i knew how but things don't mostly come out of the box working but at least tell me where can i go from to solve the issue? im not really a networking expert i just program stuff and for some reason the function doesn't work. i wanted to know if i did something wrong so what im asking for here is like best practices on using firebase emulator suite with react native firebase

mikehardy commented 1 year ago

Combine the results of two searches: "How do I find the IP address of my computer?" ---> remember this IP address "How do I get the firebase emulator to listen to all addresses?" --> it is probably altering firebase.json in the directory with the firebase emulator to use host "0.0.0.0" but you will want to read the actual documentation

Start the emulator Configure your javascript to use the functions emulator at the IP address for your computer

R4Y-R4Y commented 1 year ago

Combine the results of two searches:

"How do I find the IP address of my computer?" ---> remember this IP address

"How do I get the firebase emulator to listen to all addresses?" --> it is probably altering firebase.json in the directory with the firebase emulator to use host "0.0.0.0" but you will want to read the actual documentation

Start the emulator

Configure your javascript to use the functions emulator at the IP address for your computer

So in this case, the code and workflow in the docs is wrong and it needs to be changed

mikehardy commented 1 year ago

Please be specific: where (please provide URL to which doc you mean) and how (please point out which part is wrong and how) - we can update things as needed. In fact - each doc has a link at the top right and GitHub web UI has an easy workflow to make text edits to markdown files to update docs if there's a gap somewhere

R4Y-R4Y commented 1 year ago

Please be specific: where (please provide URL to which doc you mean) and how (please point out which part is wrong and how) - we can update things as needed. In fact - each doc has a link at the top right and GitHub web UI has an easy workflow to make text edits to markdown files to update docs if there's a gap somewhere

https://rnfirebase.io/functions/usage#using-an-emulator this part specifically it tells to use the localhost link http://localhost:5000 which is the wrong one to use for the cloud function and its actually the ip address or the emulator's ip address

mikehardy commented 1 year ago

localhost:5000 is correct for almost everyone, as mentioned above, since most dev is using the android emulator and localhost is changed by our code to the semi-magical 10.0.2.2 emulator internal device. You may consult the code to verify. If you want to use a real device it states specifically in the logs that you need the IP address, doesn't it?

https://github.com/invertase/react-native-firebase/blob/54f60128502e25e1026a2e093ef42ae46977cbe6/packages/functions/lib/index.js#L144-L173

R4Y-R4Y commented 1 year ago

localhost:5000 is correct for almost everyone, as mentioned above, since most dev is using the android emulator and localhost is changed by our code to the semi-magical 10.0.2.2 emulator internal device. You may consult the code to verify. If you want to use a real device it states specifically in the logs that you need the IP address, doesn't it?

https://github.com/invertase/react-native-firebase/blob/54f60128502e25e1026a2e093ef42ae46977cbe6/packages/functions/lib/index.js#L144-L173

well that's another reason for the docs being a little ambiguous. should i use useEmulator or useFunctionsEmulator? are they both the same? which one is recommended? also how can i verify if the call is being sent through the dev environment and not the production one? there are some things that are kind of unclear. it just tells me to use this function and that's it. it "might" work as you said but might isn't always.

mikehardy commented 1 year ago

should i use useEmulator or useFunctionsEmulator

useFunctionsEmulator is deprecated

https://github.com/invertase/react-native-firebase/blob/54f60128502e25e1026a2e093ef42ae46977cbe6/packages/functions/lib/index.d.ts#L382

also how can i verify if the call is being sent through the dev environment and not the production one

the words dev and production are ambiguous themselves, I have non-emulator dev environments. I think what you mean is emulator or non-emulator, but that highlights how easy ambiguity creeps in. You can verify because your functions emulator will display that it was called though, in its console. Also by modifying your functions code to print anything, and not deploy it then attempt to run it, and you'll see that it printed what you put in there? Same as verifying any code is running when you think it is running - put in a dummy change and verify it?

Any code might work or might not, any configuration the same. If there is ambiguity in the docs please be specific and non-ambiguous about where and what - best method is via a direct edit and PR proposal.

May I assume at this point that you are successfully developing against your functions emulator? Is there any other action here or do you intend to raise a PR?

dcsan commented 1 year ago

I'm having a similar problem. I added a method at startup to ping our server, and I don't see any request to the server.

then, the client app will crash

is there any way to find out which host we are connecting to? I understand there are some defaults picked up at startup, but not sure if these are even being read correctly now.

import firestore from "@react-native-firebase/firestore";
import firebaseFunctions, { FirebaseFunctionsTypes } from "@react-native-firebase/functions";
import auth, { firebase, FirebaseAuthTypes } from "@react-native-firebase/auth";

let functions: FirebaseFunctionsTypes.Module = firebaseFunctions().app.functions("us-east4");

console.log("__DEV__ firebase config start");

functions.useEmulator('localhost', 5001);
firebase.auth().useEmulator('http://localhost:9099');
console.log("firebase config.done");

export async function checkConnection() {
  console.log('checking connection.start')
  try {
    const response = await functions.httpsCallable("v2-personas-postPing")();
    console.log('checkConnection.response', response.data.data)
  } catch (error) {
    console.error('checkConnection.error', error.stack) // always crashes here
  }
}

checkConnection()

the error message isn't helpful, asking me to dig deep in the bundle

 ERROR  checkConnection.error Error: An internal error has occurred, print and inspect the error details for more information.
    at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dev.xyz.revel.ios:125821:58)
    at ?anon_0_ (http://localhost:8081/src/services/firebase.bundle?platform=ios&modulesOnly=true&app=dev.xyz.revel.ios&dev=true&minify=false&runModule=true&shallow=true:45:77)
    at next (native)
    at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dev.xyz.revel.ios:1120:26)
    at _next (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dev.xyz.revel.ios:1139:29)
    at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dev.xyz.revel.ios:1144:14)
    at tryCallTwo (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:61:9)
    at doResolve (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:216:25)
    at Promise (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:82:14)
    at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=dev.xyz.revel.ios:1136:25)
    at apply (native)

env config:

node -v
v16.16.0
npm -v
8.11.0
yarn -v
1.22.19
npx tsc --version
Version 4.9.4
/usr/bin/xcodebuild -version
Xcode 14.2
Build version 14C18
yarn list @react-native-firebase/functions
yarn list v1.22.19
warning Resolution field "react-native-svg@13.2.0" is incompatible with requested version "react-native-svg@^13.6.0"
warning Filtering by arguments is deprecated. Please use the pattern option instead.
└─ @react-native-firebase/functions@16.5.0
✨  Done in 0.24s.
yarn list expo
yarn list v1.22.19
warning Resolution field "react-native-svg@13.2.0" is incompatible with requested version "react-native-svg@^13.6.0"
warning Filtering by arguments is deprecated. Please use the pattern option instead.
└─ expo@46.0.17
✨  Done in 0.23s.
yarn list @notifee/react-native
yarn list v1.22.19
warning Resolution field "react-native-svg@13.2.0" is incompatible with requested version "react-native-svg@^13.6.0"
warning Filtering by arguments is deprecated. Please use the pattern option instead.
└─ @notifee/react-native@5.7.0
✨  Done in 0.24s.
 expo doctor
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                         β”‚
β”‚   There is a new version of expo-cli available (6.1.0).                 β”‚
β”‚   You are currently using expo-cli 6.0.8                                β”‚
github-actions[bot] commented 1 year ago

Hello πŸ‘‹, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.