Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
no se pudo leer la transmisión, no existe StreamNotFoundError: transmisión no encontrada

Según la documentación:

https://developers.eventstore.com/clients/grpc/reading-events.html#reading-backwards-1

debajo: Verificando si la transmisión existe

 const events = client.readStream("user", { direction: FORWARDS, fromRevision: BigInt(10), maxCount: 20, }); try { for await (const resolvedEvent of events) { console.log(resolvedEvent.event?.data); } } catch (error) { if (error instanceof StreamNotFoundError) { return; } throw error; }

consigo:

 failed to read stream, no exist StreamNotFoundError: user not found

Sus tutoriales me parecen obsoletos.

P: ¿Hay alguna manera de verificar si existe una transmisión (y tal vez agregarla si no es así) en la tienda de eventos en 2022?

Edición 2:

después de los intentos, todavía se muestra con la respuesta provista: node:events:505 throw er; // Evento 'error' no manejado ^

 StreamNotFoundError: user not found at ReadStream._transform (game\node_modules\@eventstore\db-client\dist\streams\utils\ReadStream.js:50:32)
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

No estoy seguro de lo que tiene en su base de datos, pero rápidamente copié el código de muestra y funciona como se esperaba.

 const {EventStoreDBClient, FORWARDS, StreamNotFoundError, START} = require("@eventstore/db-client"); async function main() { const CLOUD_ID = "ca1loplo0aepjgt215o0"; const client = EventStoreDBClient.connectionString`esdb+discover://${CLOUD_ID}.mesdb.eventstore.cloud`; const events = client.readStream("doesntexist", { direction: FORWARDS, fromRevision: START, maxCount: 20, }); try { for await (const resolvedEvent of events) { console.log(resolvedEvent.event?.data); } } catch (error) { if (error instanceof StreamNotFoundError) { console.log("Stream not found"); return; } throw error; } } main().then(() => console.log("done"));

Cuando lo ejecuto me sale:

 Stream not found done
about 4 years ago · Juan Pablo Isaza Report

0

El problema aquí parece ser que está tratando de verificar si la transmisión existe después de que ya terminó de llamarse.

Puede ser útil mover client.readStream() dentro de try/catch , esperarlo directamente y luego repetir según sea necesario. Esto al menos reduce el punto en el que va mal y falla antes de que comience el bucle for.

 try { // Moved down into try block! const events = await client.readStream("user", { direction: FORWARDS, fromRevision: BigInt(10), maxCount: 20, }); for (const resolvedEvent of events) { console.log(resolvedEvent.event?.data); } ... } catch (error) {...}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!