Skip to content

Query.toString as input to refFromURL doesn't work, throws error #7833

Open
@marcusx2

Description

@marcusx2

Operating System

macOS

Browser Version

Safari 16.5.2

Firebase SDK Version

10.6.0

Firebase SDK Product:

Database

Describe your project's tooling

index.html with source tag. Just javascript.

Describe the problem

The Query.toString() specifically says that the resulting URL is to be used with refFromURL. Yet, it doesn't work. It throws the error @firebase/database:"FIREBASE FATAL ERROR: Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com ".

Steps and code to reproduce issue

const firebaseConfig = {
   ...
    databaseURL: "https://xxxxx-xxxxx-xxxxx-rtdb.europe-west1.firebasedatabase.app",
  ...
};


const app = initializeApp(firebaseConfig);
const db = getDatabase();
const postListRef = ref(db, 'posts');
refFromURL(db, postListRef.toString());

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions