小编Qui*_*ice的帖子

在 Firebase / React 上创建存储引用时出现“TypeError: db._checkNotDeleted is not a function”

我正在 React 上创建一个应用程序,它使用 Firebase 作为后端数据,并希望能够上传图片。当尝试通过 firebase 获取存储引用时,出现以下错误:

在此输入图像描述

每次我尝试获取对存储的引用时,都会收到此错误。我还在 firebase 上使用实时数据库,但我认为这根本不会干扰。下面是调用的代码:

import database, { auth, provider, storage } from '../../components/utils/firebase.js';
import { uploadBytes } from '@firebase/storage';

...
        handleSubmit(e) {
        e.preventDefault();

        const file = e.target[0].files[0];
        console.log("File: ", file);
        
        if (!file) {
            console.log("No file!");
          } else {
            const storageRef = ref(storage, `images/${file.name}`);
            uploadBytes(storageRef, file);
            console.log("Uploaded file!");
            console.log("File: " + file);
          }
        
    }
Run Code Online (Sandbox Code Playgroud)

firebase.js(我的配置文件):

import { initializeApp } from 'firebase/app';
import { getDatabase } from 'firebase/database';
import  { getAuth, GoogleAuthProvider } from 'firebase/auth';
import …
Run Code Online (Sandbox Code Playgroud)

javascript file firebase reactjs google-cloud-platform

7
推荐指数
1
解决办法
8729
查看次数