Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service database is not available with firebase 10.13 #8450

Open
GabrielRalph opened this issue Aug 22, 2024 · 3 comments
Open

Service database is not available with firebase 10.13 #8450

GabrielRalph opened this issue Aug 22, 2024 · 3 comments

Comments

@GabrielRalph
Copy link

GabrielRalph commented Aug 22, 2024

Operating System

Mac OS

Environment (if applicable)

Chrome

Firebase SDK Version

10.133

Firebase SDK Product(s)

Auth, Database

Project Tooling

Vanila Javascript, VS Code Live Server

Detailed Problem Description

I have tried to retrieve the database object using the getDatabase method from "https://www.gstatic.com/firebasejs/10.13/firebase-database.js".

When the function is called it throws an error "Error: Service database is not available".

Down grading to the last version 10.12.5 fixes this bug, so I assume it was associated with the newest release.

Steps and code to reproduce issue

import {initializeApp} from 'https://www.gstatic.com/firebasejs/10.13/firebase-app.js'
import {getAuth as _getAuth, signInWithRedirect as _signInWithRedirect, GoogleAuthProvider, onAuthStateChanged as _onAuthStateChange} from 'https://www.gstatic.com/firebasejs/10.13/firebase-auth.js'
import {getDatabase as _getDatabase, child, push, ref as _ref, update, get, onValue, onChildAdded, onChildChanged, onChildRemoved, set, off} from "https://www.gstatic.com/firebasejs/10.13/firebase-database.js"

// Include this script in a html document and the error should occur

const CONFIG = {...}

const App = initializeApp(CONFIG);
const Database = _getDatabase(App);
const Auth = _getAuth();

export function getApp() {return App}
export function getDatabase() {return Database}
export function getAuth() {return Auth}
export function ref(path) {return _ref(Database, path)}
export function signInWithRedirect(provider) {return _signInWithRedirect(Auth, provider)}
export function onAuthStateChanged(callback) {return _onAuthStateChange(Auth, callback)}

export {child, push, update, get, onValue, onChildAdded, onChildChanged, onChildRemoved, set, off, GoogleAuthProvider}

@GabrielRalph GabrielRalph added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Aug 22, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: database needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Aug 22, 2024
@dlarocque
Copy link
Contributor

Hi @GabrielRalph, could you please try changing the versions from 10.13 to 10.13.0? I reproduced this and got the same error you did, and was able to fix it by doing this.

Firebase requires all the services being used to be the exact same version, and it seems that if we don't specify the patch version, it uses different versions for app and database, which causes this error. Locally, it was using version 10.13.0 for database, and 10.13 for app.

image

@google-oss-bot
Copy link
Contributor

Hey @GabrielRalph. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants