googlearchive / firebase-dart

Dart wrapper for Firebase
https://pub.dev/packages/firebase
404 stars 144 forks source link

[firestore] - dart.global.firebase.firestore is not a function #325

Closed Ahmadre closed 4 years ago

Ahmadre commented 4 years ago

Because this issue is based on firebase-dart, here's the referenced issue: https://github.com/FirebaseExtended/flutterfire/issues/2805

If someone can help, I would be really thankful. I can't use firebase anymore for Flutter Web since this error.

tried several workaround, git threads, stackoverflow....

josephmalisov commented 4 years ago

Hi. Did you ever find a fix? I've had the same bug for a long time now...

Ahmadre commented 4 years ago

@josephmalisov actual not, I never found the reason or solution. Somehow one day it worked like magic 😂

josephmalisov commented 4 years ago

@Ahmadre this got rid of the error for me: firebase script MUST be the following (VERSION 7.5) <script src="https://www.gstatic.com/firebasejs/7.5.0/firebase-app.js"></script>

sartorinahuel commented 4 years ago

@Ahmadre this got rid of the error for me: firebase script MUST be the following (VERSION 7.5) <script src="https://www.gstatic.com/firebasejs/7.5.0/firebase-app.js"></script>

it worked for me! if you copied from firebase config tutorialit says 7.17.1... with 7.5.0 it worked. thanks!!

kartikbathla commented 4 years ago

I have version 7.5.0 but it is still giving me the same error

PQVy commented 4 years ago

I used cloud_firestore: ^0.14.0+2 and script

and it work

GroverMolina commented 4 years ago

I used cloud_firestore: ^0.14.0+2 and script

and it work

Worked like a charm, thanks dude

MeshkaniMohammad commented 4 years ago

if you use firebase_auth: ^0.18.0+1, you should use src="https://www.gstatic.com/firebasejs/7.14.4/firebase-firestore.js"></script> too.

abdullah4one commented 3 years ago

TypeError: dart.global.firebase.firestore is not a function at Object.firestore$ [as firestore] (http://localhost:55823/packages/firebase/src/top_level.dart.lib.js:94:55) at new cloud_firestore_web.FirebaseFirestoreWeb.new (http://localhost:55823/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:753:37) at Function.registerWith (http://localhost:55823/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:669:73) at Object.registerPlugins (http://localhost:55823/packages/noted/generated_plugin_registrant.dart.lib.js:19:46) at main (http://localhost:55823/web_entrypoint.dart.lib.js:29:35) at main.next () at runBody (http://localhost:55823/dart_sdk.js:37922:34) at Object._async [as async] (http://localhost:55823/dart_sdk.js:37953:7) at main$ (http://localhost:55823/web_entrypoint.dart.lib.js:28:18) at http://localhost:55823/main_module.bootstrap.js:20:10 at Array.forEach () at window.$dartRunMain (http://localhost:55823/main_module.bootstrap.js:19:32) at :1:8 at Object.runMain (http://localhost:55823/dwds/src/injected/client.js:8764:21) at http://localhost:55823/dwds/src/injected/client.js:22538:19 at _wrapJsFunctionForAsync_closure.$protected (http://localhost:55823/dwds/src/injected/client.js:3793:15) at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:55823/dwds/src/injected/client.js:11010:12) at Object._asyncStartSync (http://localhost:55823/dwds/src/injected/client.js:3757:20) at mainclosure1.$call$body$mainclosure (http://localhost:55823/dwds/src/injected/client.js:22550:16) at mainclosure1.call$1 (http://localhost:55823/dwds/src/injected/client.js:22477:19) at StaticClosure._rootRunUnary [as call$2$5] (http://localhost:55823/dwds/src/injected/client.js:4124:16) at _CustomZone.runUnary$2$2 (http://localhost:55823/dwds/src/injected/client.js:12315:39) at _CustomZone.runUnaryGuarded$1$2 (http://localhost:55823/dwds/src/injected/client.js:12247:14) at _ControllerSubscription._sendData$1 (http://localhost:55823/dwds/src/injected/client.js:11798:19) at _DelayedData.perform$1 (http://localhost:55823/dwds/src/injected/client.js:11950:59) at _PendingEvents_schedule_closure.call$0 (http://localhost:55823/dwds/src/injected/client.js:11999:14) at Object._microtaskLoop (http://localhost:55823/dwds/src/injected/client.js:3960:24) at StaticClosure._startMicrotaskLoop (http://localhost:55823/dwds/src/injected/client.js:3966:11) at _AsyncRuninitializeScheduleImmediate_internalCallback.call$1 (http://localhost:55823/dwds/src/injected/client.js:10879:9) at invokeClosure (http://localhost:55823/dwds/src/injected/client.js:1204:26) at MutationObserver. (http://localhost:55823/dwds/src/injected/client.js:1223:18)

Levi-Lesches commented 3 years ago

If you're using a Firebase Hosting Reserved URL (the one that starts with a __), it won't work unless you also start up the Firebase Hosting Emulator. This conflicts with flutter run though, so I suggest using the CDN link (the one that starts with gstatic).

oliverbytes commented 3 years ago

Same problem.. solved by carefully following instructions here: https://firebase.flutter.dev/docs/firestore/overview

lkrjangid1 commented 3 years ago

hello, I am using everything but it shows me an error.

`Launching lib\main.dart on Chrome in debug mode... Waiting for connection from debug service on Chrome... Debug service listening on ws://127.0.0.1:57017/9pY4IO1vQUg=/ws

Running with unsound null safety For more information see https://dart.dev/null-safety/unsound-null-safety Debug service listening on ws://127.0.0.1:57017/9pY4IO1vQUg=/ws TypeError: dart.global.firebase.firestore is not a function at Object.getFirestoreInstance (http://localhost:56918/packages/cloud_firestore_web/src/interop/utils/utils.dart.lib.js:998:79) at new cloud_firestore_web.FirebaseFirestoreWeb.new (http://localhost:56918/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:864:37) at Function.registerWith (http://localhost:56918/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:746:73) at Object.registerPlugins (http://localhost:56918/packages/flutter_appfirebase/generated_plugin_registrant.dart.lib.js:14:46) at main (http://localhost:56918/web_entrypoint.dart.lib.js:30:35) at main.next () at runBody (http://localhost:56918/dart_sdk.js:38027:34) at Object._async [as async] (http://localhost:56918/dart_sdk.js:38058:7) at main$ (http://localhost:56918/web_entrypoint.dart.lib.js:29:18) at http://localhost:56918/main_module.bootstrap.js:19:10 at Array.forEach () at window.$dartRunMain (http://localhost:56918/main_module.bootstrap.js:18:32) at :1:8 at Object.runMain (http://localhost:56918/dwds/src/injected/client.js:8656:21) at http://localhost:56918/dwds/src/injected/client.js:22068:19 at _wrapJsFunctionForAsync_closure.$protected (http://localhost:56918/dwds/src/injected/client.js:3830:15) at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:56918/dwds/src/injected/client.js:10905:12) at Object._asyncStartSync (http://localhost:56918/dwds/src/injected/client.js:3794:20) at mainclosure1.$call$body$mainclosure (http://localhost:56918/dwds/src/injected/client.js:22080:16) at mainclosure1.call$1 (http://localhost:56918/dwds/src/injected/client.js:22007:19) at StaticClosure._rootRunUnary [as call$2$5] (http://localhost:56918/dwds/src/injected/client.js:4153:16) at _CustomZone.runUnary$2$2 (http://localhost:56918/dwds/src/injected/client.js:12136:39) at _CustomZone.runUnaryGuarded$1$2 (http://localhost:56918/dwds/src/injected/client.js:12068:14) at _ControllerSubscription._sendData$1 (http://localhost:56918/dwds/src/injected/client.js:11697:19) at _DelayedData.perform$1 (http://localhost:56918/dwds/src/injected/client.js:11849:59) at _PendingEvents_schedule_closure.call$0 (http://localhost:56918/dwds/src/injected/client.js:11898:14) at Object._microtaskLoop (http://localhost:56918/dwds/src/injected/client.js:3990:24) at StaticClosure._startMicrotaskLoop (http://localhost:56918/dwds/src/injected/client.js:3996:11) at _AsyncRuninitializeScheduleImmediate_internalCallback.call$1 (http://localhost:56918/dwds/src/injected/client.js:10774:9) at invokeClosure (http://localhost:56918/dwds/src/injected/client.js:1250:26) at MutationObserver. (http://localhost:56918/dwds/src/injected/client.js:1269:18)`

`<!DOCTYPE html>

mbmelearning `
Levi-Lesches commented 3 years ago

Can you show us your index.html and your pubspec.yaml?