Skip to content

Commit

Permalink
Add error handling in TP/ICAP (#3627)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
1 parent eee067f commit 5521ad4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/great-hornets-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chainlink/icap-adapter': minor
'@chainlink/tp-adapter': minor
---

Error Handling
6 changes: 6 additions & 0 deletions .changeset/rotten-llamas-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chainlink/icap-adapter': patch
'@chainlink/tp-adapter': patch
---

Add possible solutions to frequent errors
2 changes: 2 additions & 0 deletions packages/sources/icap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 28 additions & 5 deletions packages/sources/tp/src/transport/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 5521ad4

Please sign in to comment.