Skip to content

Connection interruption terminates the whole process, doesn't allow to be try/caught #34

@rik-iso

Description

@rik-iso

I'm trying to make the code resilient to a Aurora RDS failover (which interrupts the connection to the master). I'm wrapping my await service.subscribe(plugin, REPLICATION_SLOT_NAME) in a try/catch, but when I fail over the whole process just ends:

/Users/rik/iso/Code/graph/node_modules/.pnpm/[email protected]/node_modules/eventemitter2/lib/eventemitter2.js:1053
        throw arguments[1]; // Unhandled 'error' event
        ^

Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/Users/rik/iso/Code/graph/node_modules/.pnpm/[email protected]/node_modules/pg/lib/client.js:132:73)
    at Object.onceWrapper (node:events:628:28)
    at Connection.emit (node:events:514:28)
    at Connection.emit (node:domain:489:12)
    at Socket.<anonymous> (/Users/rik/iso/Code/graph/node_modules/.pnpm/[email protected]/node_modules/pg/lib/connection.js:63:12)
    at Socket.emit (node:events:514:28)
    at Socket.emit (node:domain:489:12)
    at TCP.<anonymous> (node:net:323:12)

Node.js v18.17.1

This occurs if I use the example code in the README too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions