Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
Error when creating a new document inside a new subcollection in firestore

I am using the v9 Web SDK.

I have a collection called 'transactions-in' which keeps a record of every transaction into a cardano wallet.

From time to time my server will send a transaction in response to each transaction in this collection (such as sending an nft or refunding ADA) and I want to add these transactions into a subcollection on the relevant transaction document, so the structure looks like this:

  • collection: 'payments_in'
  • document: document ID
  • subcollection: 'related_transactions'
  • document: newly created document reference

This is the code I have to get the right path to the newly created document ref and upload some test data into the firebase emulator:

  //1. Get current doc
  const currentDoc = doc(db, 'payments_in', transactionId);

  //2. Build refund database entry
  //2A. Get collection from database (will create one if doesn't exist)
  const newCollection = collection(currentDoc, 'related_transactions');

  //2B. Get a new document from database within new collection
  const newSubDoc = doc(newCollection);

  //2C. Upload entry to database
  await setDoc(newSubDoc, { test: 'test' });

When I log the path of newSubDoc I get this, so the path looks good (I think??): payments_in/kXK5pimm29nRhU4CohA6/related_transactions/NL11eYmsB4M9vHw6PI8X

However when I try to submit the entry using setDoc I get the following error message:

@firebase/firestore: Firestore (9.1.1): Connection GRPC stream error. 
Code: 3 Message: 3 INVALID_ARGUMENT: Document name "projects//databases/(default)/documents/payments_in/kXK5pimm29nRhU4CohA6/related_transactions/tLoCiHUJaA2uYhxt7drb" 
lacks a project id at index 9.

Does anyone see what I am doing wrong here?

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you look at the path in the error message, it is missing a project ID after projects/: projects//databases/(default)/documents/payments_in/kXK5pimm29nRhU4CohA6/related_transactions/tLoCiHUJaA2uYhxt7drb. You might want to double check how you initialize db and whether your Firebase configuration is complete.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda