首页 > 解决方案 > (333c7ef) 流以状态关闭:状态{code=RESOURCE_EXHAUSTED,描述=超出配额。,原因=null}

问题描述

每当我尝试登录时,它都会向我显示此错误。

我在线检查了配额超出错误,但无法将原因与我的情况联系起来,因为我是目前唯一一个操作此应用程序的人,因此身份验证请求的数量甚至没有超过 20。我检查了文本表单域正在注册输入的数据。此外,用户是在 Firebase 身份验证上创建的,而不是在 Firestore 数据库上创建的。我已经更改了 firestore 的规则,以便我们可以在上面写字。

这是我的登录页面的代码

import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/painting.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:live_location_app/screens/Home.dart';

import 'login_screen.dart';

class SignUpPage extends StatefulWidget {
  const SignUpPage({Key? key}) : super(key: key);

  @override
  _SignUpPageState createState() => _SignUpPageState();
}

class _SignUpPageState extends State<SignUpPage> {

  String email = '';
  String password = '';
  String name= '';
  String location= '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(

      appBar: AppBar(
        title: Center(child: Row(
          children: [SizedBox(width: 80,),
            Text('Sign Up',style: GoogleFonts.pacifico(fontSize: 30.0)),

          ],
        )),
        backgroundColor: Colors.brown[900],
        toolbarHeight: 70.0,
      ),
      backgroundColor: Colors.brown[200],
      body:SingleChildScrollView(
    child: Center(
        child: Column(
          children: [

               Image.network('https://static.thenounproject.com/png/1120654-200.png'),

            Container(
              width:370,
              child: TextFormField(
                onChanged: (val){
                  email = val;
                  print(email);
                },
                cursorColor: Colors.brown,
                decoration: InputDecoration(
                  labelText: "Email ID",
                  labelStyle: TextStyle(color: Colors.brown[800],fontWeight: FontWeight.bold,fontSize: 20.0),
                  contentPadding: EdgeInsets.fromLTRB(10, 50, 10, 0),

                  fillColor: Colors.brown,
                  focusedBorder:OutlineInputBorder(
                    borderSide: const BorderSide(color: Colors.brown, width: 2.0),
                    borderRadius: BorderRadius.circular(25.0),
                  ),
                ),
              ),
            ),
            SizedBox(height: 20.0),
            Container(
              width:370,
              child: TextFormField(
                onChanged: (val){
                  password = val;
                  print(password);
                },
                obscureText: true,
                cursorColor: Colors.brown,
                decoration: InputDecoration(
                  labelText: "Password",
                  labelStyle: TextStyle(color: Colors.brown[800],fontWeight: FontWeight.bold,fontSize: 20.0),
                  contentPadding: EdgeInsets.fromLTRB(10, 50, 10, 0),

                  fillColor: Colors.brown,
                  focusedBorder:OutlineInputBorder(
                    borderSide: const BorderSide(color: Colors.brown, width: 2.0),
                    borderRadius: BorderRadius.circular(25.0),
                  ),
                ),
              ),
            ),
            SizedBox(height: 20.0),
            Container(
              width:370,
              child: TextFormField(
                onChanged: (val){
                  name = val;
                  print(name);
                },
                cursorColor: Colors.brown,
                decoration: InputDecoration(
                  labelText: "Name",
                  labelStyle: TextStyle(color: Colors.brown[800],fontWeight: FontWeight.bold,fontSize: 20.0),
                  contentPadding: EdgeInsets.fromLTRB(10, 50, 10, 0),

                  fillColor: Colors.brown,
                  focusedBorder:OutlineInputBorder(
                    borderSide: const BorderSide(color: Colors.brown, width: 2.0),
                    borderRadius: BorderRadius.circular(25.0),
                  ),
                ),
              ),
            ),
            SizedBox(height: 40.0),
            Container(
              height: 70.0,
              width: 200,
              child: ElevatedButton(
                onPressed: () async{
                  try {
                    UserCredential userCredential = await FirebaseAuth.instance.createUserWithEmailAndPassword(
                        email: email,
                        password: password
                    );
                    FirebaseFirestore.instance.collection('users')
                      .doc(email)
                      .set({
                        'name' : name,
                        'email': email,
                        'uid' : email,
                        'Location': location,
                      'password': password,
                      })

                      .then((value) {
                      Navigator.push(context, MaterialPageRoute(builder: (context) => Home( name: name, email: email)));
                      })
                      .catchError((err) {
                        print(err);
                      });

                  } on FirebaseAuthException catch (e) {
                    if (e.code == 'weak-password') {
                      print('The password provided is too weak.');
                    } else if (e.code == 'email-already-in-use') {
                      print('The account already exists for that email.');
                    }
                  } catch (e) {
                    print(e);
                  }
                },
                style: ElevatedButton.styleFrom(shape:  RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(30.0),
                ),
                  primary: Colors.brown[900],
                  elevation: 10.0,
                ),
                child: Text(
                  'Sign Up',
                  style: GoogleFonts.pacifico(fontSize: 25.0),
                ),
              ),
            ),
            SizedBox(height: 20.0),
            Divider(thickness: 2.0),
            SizedBox(height: 10.0),
            Center(
              child: Row(
                children: [
                  SizedBox(width: 110.0),
                  Text("Already have an account?",
                    style: TextStyle(fontSize: 15.0),),
                  GestureDetector(onTap: (){
                    Navigator.push(context, MaterialPageRoute(builder: (context) => LoginScreen( )));

                  },
                      child: Text('Login',
                          style: TextStyle(fontStyle: FontStyle.italic,fontSize: 15.0)))
                ],
              ),
            )
          ],
        ),
      ),
    )
    );
  }
}

有人可以帮我解决这个问题。谢谢

标签: androidfirebasefluttergoogle-cloud-firestore

解决方案


很难用您共享的信息说出导致违反配额限制的原因,但事实是您得到的错误确实是配额耗尽错误,因此为了修复它,您需要增加你的配额。

假设您是免费套餐用户,根据您在问题中提到的内容,我建议您查看此文档以了解有关定价的更多信息,并考虑转向 Blaze 计划(该计划有现收现付基础) .


推荐阅读