loopbackio / loopbackio/loopback-connector-postgresql

Error when using transaction timeout

Open
#471 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
118
Forks
184
Avg merge
1d 22h
Merged PRs (30d)
5

Description

Steps to reproduce

loopback-connector-postgresql version is 5.3.0
node version is v14.1.0

await app.datasources.db.transaction(async myTxModels => {
    await customFunction(element, {
        db1: db1TxModels, 
        db2: db2Models
    }).catch(err => { throw err });

}, { timeout: 240000 });

Current Behavior

aftersome time, app crashes with the following error

tx.notifyObserversOf('timeout', context, function(err) {
           ^

TypeError: tx.notifyObserversOf is not a function
    at Timeout._onTimeout (\node_modules\loopback-connector\lib\transaction.js:124:12)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the transaction timeout with loopback-connector-postgresql 5.3.0 and Node v14.1.0, then inspect node_modules/loopback-connector/lib/transaction.js at line 124 and the surrounding timeout handling. Done means the timeout path no longer raises “tx.notifyObserversOf is not a function” or crashes the app.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.