无法读取数据库URL项目。

huangapple go评论51阅读模式
英文:

can not read dataBaseURl project

问题

I'm sorry, but it seems like there's an issue with the code you provided. The error message suggests that you need to include a Project ID when calling firebase.initializeApp(). Here's the translated code snippet:

import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js";
import { getDatabase, ref, push, onValue } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js";

var AppSettings = {
  dataBaseURL:
    "https://playground-e37ce-default-rtdb.europe-west1.firebasedatabase.app/",
};

Please make sure to include the Project ID when initializing Firebase to resolve the error.

英文:
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js";
import { getDatabase, ref, push, onValue } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js";

var AppSettings = {
  dataBaseURL:
    "https://playgroung-e37ce-default-rtdb.europe-west1.firebasedatabase.app/",
};

i gettinf an Error message in the conseol "ATAL ERROR: Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()"

答案1

得分: 0

The error you got is telling you to include the id of your project while calling the firebase.inititlizeApp(). You can try something like this:

错误提示你在调用 firebase.inititlizeApp() 时需要包括项目的 ID。你可以尝试像这样做:

import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js";
import { getDatabase, ref, push, onValue } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js";

var firebaseConfig = {
  apiKey: "YOUR_API_KEY",
  authDomain: "YOUR_AUTH_DOMAIN",
  databaseURL: "YOUR_DATABASE_URL",
  projectId: "YOUR_PROJECT_ID",
  storageBucket: "YOUR_STORAGE_BUCKET",
  messagingSenderId: "YOUR_SENDER_ID",
  appId: "YOUR_APP_ID",
  measurementId: "YOUR_MEASUREMENT_ID"
};

const app = initializeApp(firebaseConfig);

var AppSettings = {
  dataBaseURL:
    "https://playgroung-e37ce-default-rtdb.europe-west1.firebasedatabase.app/",
};

const database = getDatabase(app, AppSettings.dataBaseURL);

// write your code ...
英文:

The error you got is telling you to include the id of your project while calling the firebase.inititlizeApp(). You can try something like this:

import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js";
import { getDatabase, ref, push, onValue } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js";

var firebaseConfig = {
  apiKey: "YOUR_API_KEY",
  authDomain: "YOUR_AUTH_DOMAIN",
  databaseURL: "YOUR_DATABASE_URL",
  projectId: "YOUR_PROJECT_ID",
  storageBucket: "YOUR_STORAGE_BUCKET",
  messagingSenderId: "YOUR_SENDER_ID",
  appId: "YOUR_APP_ID",
  measurementId: "YOUR_MEASUREMENT_ID"
};

const app = initializeApp(firebaseConfig);

var AppSettings = {
  dataBaseURL:
    "https://playgroung-e37ce-default-rtdb.europe-west1.firebasedatabase.app/",
};

const database = getDatabase(app, AppSettings.dataBaseURL);

// write your code ...

huangapple
  • 本文由 发表于 2023年5月10日 21:06:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76218779.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定