Skip to content

Can not access named database #7491

@aronsuarez

Description

@aronsuarez

Operating System

web

Browser Version

Chrome 114.0.5735.198 (Official Build) (arm64)

Firebase SDK Version

9.23.0

Firebase SDK Product:

Firestore

Describe your project's tooling

Vue App with vite

Describe the problem

I want to try the new named database feature of firestore but when i try to access a named database from the client i get always an FirebaseError: Missing or insufficient permissions. error.

When I switch back to (default) database everything works fine.

Here my security rules:

rules_version = '2';
service cloud.firestore {
	match /databases/{database}/documents {
    
    match /admin/{elementId} {
    	allow read, write: if database == 'test-db'
    }
    
    match /admin2/{elementId} {
    	allow read, write: if database == '(default)'
    }
  
    //
    // Users
    //
    match /users/{userId} {
    	allow get, write: if true
    }
  }
}

Steps and code to reproduce issue

When I init the Firestore instance like this:

const firestore = getFirestore('test-db')

It's not working, if I do that:

const firestore = getFirestore()

It works

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions