From 5521ad4befbb7ceceda994fd9c3d1ddd8d27c578 Mon Sep 17 00:00:00 2001 From: Subarna Singh Date: Tue, 28 Jan 2025 18:21:54 +0530 Subject: [PATCH] Add error handling in TP/ICAP (#3627) * Add error handling in TP/ICAP * changeset * add possible solutions * Update README * Updated changeset * Changes based on comments --------- Co-authored-by: app-token-issuer-data-feeds[bot] <134377064+app-token-issuer-data-feeds[bot]@users.noreply.github.com> --- .changeset/great-hornets-sneeze.md | 6 ++++ .changeset/rotten-llamas-pay.md | 6 ++++ packages/sources/icap/README.md | 2 ++ packages/sources/tp/src/transport/price.ts | 33 ++++++++++++++++++---- 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .changeset/great-hornets-sneeze.md create mode 100644 .changeset/rotten-llamas-pay.md diff --git a/.changeset/great-hornets-sneeze.md b/.changeset/great-hornets-sneeze.md new file mode 100644 index 0000000000..5f754d4194 --- /dev/null +++ b/.changeset/great-hornets-sneeze.md @@ -0,0 +1,6 @@ +--- +'@chainlink/icap-adapter': minor +'@chainlink/tp-adapter': minor +--- + +Error Handling diff --git a/.changeset/rotten-llamas-pay.md b/.changeset/rotten-llamas-pay.md new file mode 100644 index 0000000000..5d90bdfe37 --- /dev/null +++ b/.changeset/rotten-llamas-pay.md @@ -0,0 +1,6 @@ +--- +'@chainlink/icap-adapter': patch +'@chainlink/tp-adapter': patch +--- + +Add possible solutions to frequent errors diff --git a/packages/sources/icap/README.md b/packages/sources/icap/README.md index 538f19c450..1f3fbeb4b8 100644 --- a/packages/sources/icap/README.md +++ b/packages/sources/icap/README.md @@ -4,6 +4,8 @@ This document was generated automatically. Please see [README Generator](../../scripts#readme-generator) for more info. +This EA has been deprecated, use TP instead. + ## Known Issues ### Concurrent connections diff --git a/packages/sources/tp/src/transport/price.ts b/packages/sources/tp/src/transport/price.ts index 5c0c7683bd..9004b470e6 100644 --- a/packages/sources/tp/src/transport/price.ts +++ b/packages/sources/tp/src/transport/price.ts @@ -51,11 +51,34 @@ export const generateTransport = () => { return new Promise((resolve) => { connection.addEventListener('message', (event: MessageEvent) => { - const { msg, sta } = JSON.parse(event.data.toString()) - if (msg === 'auth' && sta === 1) { - logger.info('Got logged in response, connection is ready') - providerDataStreamEstablishedUnixMs = Date.now() - resolve() + const { msg, sta, info } = JSON.parse(event.data.toString()) + if (msg === 'auth') { + if (sta === 1) { + logger.info('Got logged in response, connection is ready') + providerDataStreamEstablishedUnixMs = Date.now() + resolve() + } else if (sta === 0) { + if ( + info === + 'Server requested disconnection (code 2): Client limits for JSONWS exceeded (2 clients, 1 allowed)' + ) { + logger.error(`${info} + You have too many concurrent connections. + Possible Solutions: + 1. Shut off your active TP/ICAP EAs when performing the above tests. + 2. Use your supplied username for TP EA and your username appended with “-iis“ for ICAP EA. + 3. Do not deploy more than 2 EAs for TP/ICAP. + 4. If you are still unable to have more than 2 connection please contact Chainlink Labs.`) + } else if (info === 'Authentication failed (check credentials)') { + logger.error(`${info} + There is something wrong with credentials. + Possible Solutions: + 1. Doublecheck your supplied credentials and that they are being correctly provided in the header. + 2. Contact Data Provider to ensure your subscription is active. + 3. If credentials are supplied under the node licensing agreement with Chainlink Labs, please contact us.`) + } + logger.error(`${info}`) + } } }) const options = {