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.63k stars 2.2k forks source link

TypeError: (0,_ml.default) is not a function #4546

Closed scaralfred closed 3 years ago

scaralfred commented 3 years ago

4421 Issue

This error can be reproduced by simply following the steps on these pages:

mikehardy commented 3 years ago

Thanks for pointing this out - there was obviously a massive re-shape in the ML packages in this last release, but the E2E tests had pretty good coverage, I'm surprised something like this slipped through. I will investigate later today, though if in the meantime you reach in to node_modules and see something obvious you could beat me to it with a PR 😄

mikehardy commented 3 years ago

Sorry I didn't get a chance to investigate this earlier. I still haven't tried the actual reproduction steps (I opted to implement the auth emulator over the last few days, it was a very popular request...)

But we exercise this function right here:

https://github.com/invertase/react-native-firebase/blob/e3ff7bdf3e520b448ac836ab5c59557e2a619752/packages/ml/e2e/documentText.e2e.js#L161-L186

it passes E2E tests on both iOS and Android. So I'm confused. Possibilities:

freefred81 commented 3 years ago

hi i have the same error here (on IOS)

React native vs ~0.63.3

my code:

const processDocument = async (localPath: string) => { 
    const processed = await firebase .ml().cloudDocumentTextRecognizerProcessImage(
      localPath
    );

    console.warn("Found text in document: ", processed.text);

    processed.blocks.forEach(
      (block: { text: any; confidence: any; recognizedLanguages: any }) => {
        console.warn("Found block with text: ", block.text);
        console.warn("Confidence in block: ", block.confidence);
        console.warn("Languages found in block: ", block.recognizedLanguages);
      }
    );
  };

same error IMG_A71DBBEA1104-1

scaralfred commented 3 years ago

I solved this by upgrading all the firebase libraries in my project to the latest version. Although I think it was enough to upgrade just react-native-firebase/app

freefred81 commented 3 years ago

I was doing the a same thing!!

Really thnx!

Il giorno 17 nov 2020, alle ore 16:03, alfredo scarano notifications@github.com ha scritto:

I solved this by upgrading all the firebase libraries in my project. Although I think it was enough to upgrade just react-native-firebase/app

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/4546#issuecomment-728987086, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDM7Z4XKN6GL3CED7FY4Q3SQKGDNANCNFSM4TUFPMRQ.

mikehardy commented 3 years ago

Whew! I'm glad that worked. I/we understand the versioning is a bit confusing, we went with "independent" versioning for react-native-firebase sub-packages but in the end this is not a great developer experience, the next release (coming out today) will follow the firebase-ios-sdk recent change and start using One True Version so it's more clear that everything matches. We'll burn more version numbers, but those are free, and it won't be confusing

I'm going to close this as getting to current stable on everything should fix it

G1914G commented 3 years ago

Hi I have still the same problem and upgraded all the packages.

My Code:

async function processDocument(localPath) {
  const processed = await ml().cloudDocumentTextRecognizerProcessImage(localPath);

  console.log('Found text in document: ', processed.text);

  processed.blocks.forEach(block => {
    console.log('Found block with text: ', block.text);
    console.log('Confidence in block: ', block.confidence);
    console.log('Languages found in block: ', block.recognizedLanguages);
  });
}

Can you please help me out?

mikehardy commented 3 years ago

I cannot, sorry, as mentioned I can't reproduce. We have an E2E test in our CI environment that exercises the method (I think) and it appears to work.

If you can create an App.js that you drop in to an app built from this demo construction script, we might be able to reproduce - you should try it to see if it works in a clean app like that: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

wilav-dev commented 2 years ago

same issue, any idea?

lakhwinderdebut commented 4 months ago

Hi @mikehardy i have the same problem, firebase.ml() just returns app nothing else

import ml from '@react-native-firebase/ml';

Screenshot 2024-04-17 at 5 44 27 PM

currently on version: "@react-native-firebase/app": "^18.5.0", "@react-native-firebase/ml": "^19.2.2",

mikehardy commented 4 months ago

1- all react-native-firebase versions should be the same at all times https://invertase.io/blog/react-native-firebase-versioning 2- ml does not implement any APIs currently, it used to have tons and tons but firebase split out ML in firebase to just a couple model download functions here and a larger / more specific "mlkit". We have not implemented the new model downloading APIs as the module was very very low interest before and has had near zero interest to justify the investment afterwards

We would welcome any PRs that implement the APIs though: