Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Handler get_supported_fiat panicked #981

Closed
mhxw opened this issue Oct 13, 2022 · 1 comment
Closed

Handler get_supported_fiat panicked #981

mhxw opened this issue Oct 13, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@mhxw
Copy link

mhxw commented Oct 13, 2022

Describe the bug

I write an exchange data service with the same data format as the return data of exchangerates_data-api, and after setting EXCHANGE_API_BASE_URI, I get the following error.

{
    "base": "EUR",
    "date": "2022-10-13",
    "rates": {
        "AED": 3.563298,
        "AFN": 83.02756,
        "ALL": 116.34124,
        "AMD": 391.12418,
        "ANG": 1.748696,
        "AOA": 426.44717,
        "ARS": 146.51283,
        "AUD": 1.545757,
        "AWG": 1.746191,
        "AZN": 1.646901,
        "BAM": 1.953135,
        "BBD": 1.959127,
        "BDT": 98.65045,
        "BGN": 1.95716,
        "BHD": 0.365721,
        "BIF": 2004.8148,
        "BMD": 0.970106,
        "BND": 1.393213,
        "BOB": 6.704643,
        "BRL": 5.134873,
        "BSD": 0.970276,
        "BTC": 0.000050869836,
        "BTN": 79.84148,
        "BWP": 13.024427,
        "BYN": 2.459767,
        "BYR": 19014.082,
        "BZD": 1.955831,
        "CAD": 1.341153,
        "CDF": 1985.8073,
        "CHF": 0.967904,
        "CLF": 0.033207,
        "CLP": 916.2751,
        "CNY": 6.968075,
        "COP": 4470.162,
        "CRC": 610.9269,
        "CUC": 0.970106,
        "CUP": 25.707813,
        "CVE": 110.111336,
        "CZK": 24.559889,
        "DJF": 172.72293,
        "DKK": 7.438542,
        "DOP": 52.12906,
        "DZD": 136.59889,
        "EGP": 19.073645,
        "ERN": 14.551593,
        "ETB": 51.327187,
        "EUR": 1,
        "FJD": 2.254548,
        "FKP": 0.87482,
        "GBP": 0.875084,
        "GEL": 2.696646,
        "GGP": 0.87482,
        "GHS": 10.479076,
        "GIP": 0.87482,
        "GMD": 54.578297,
        "GNF": 8378.753,
        "GTQ": 7.643433,
        "GYD": 202.9967,
        "HKD": 7.615091,
        "HNL": 23.970537,
        "HRK": 7.528413,
        "HTG": 120.32005,
        "HUF": 432.24075,
        "IDR": 14887.783,
        "ILS": 3.45741,
        "IMP": 0.87482,
        "INR": 79.870346,
        "IQD": 1416.1683,
        "IRR": 41132.5,
        "ISK": 140.10233,
        "JEP": 0.87482,
        "JMD": 148.3381,
        "JOD": 0.68784,
        "JPY": 142.48824,
        "KES": 117.33404,
        "KGS": 80.84622,
        "KHR": 4006.474,
        "KMF": 493.17773,
        "KPW": 873.0955,
        "KRW": 1386.4127,
        "KWD": 0.301127,
        "KYD": 0.80858,
        "KZT": 464.43665,
        "LAK": 16324.87,
        "LBP": 1467.0526,
        "LKR": 355.6136,
        "LRD": 149.05653,
        "LSL": 17.539646,
        "LTL": 2.864471,
        "LVL": 0.586807,
        "LYD": 4.891625,
        "MAD": 10.681693,
        "MDL": 18.847797,
        "MGA": 4129.6646,
        "MKD": 61.52945,
        "MMK": 2037.6636,
        "MNT": 3243.1526,
        "MOP": 7.845233,
        "MRO": 346.32773,
        "MUR": 42.578033,
        "MVR": 14.988129,
        "MWK": 995.95667,
        "MXN": 19.404547,
        "MYR": 4.549116,
        "MZN": 61.921986,
        "NAD": 17.539747,
        "NGN": 421.77255,
        "NIO": 34.902733,
        "NOK": 10.460146,
        "NPR": 127.75198,
        "NZD": 1.728321,
        "OMR": 0.373501,
        "PAB": 0.970236,
        "PEN": 3.854081,
        "PGK": 3.419669,
        "PHP": 57.172283,
        "PKR": 211.28627,
        "PLN": 4.845346,
        "PYG": 6907.0747,
        "QAR": 3.532149,
        "RON": 4.93988,
        "RSD": 117.19102,
        "RUB": 62.11101,
        "RWF": 1033.7101,
        "SAR": 3.645803,
        "SBD": 7.906457,
        "SCR": 12.741192,
        "SDG": 550.5358,
        "SEK": 11.004627,
        "SGD": 1.391423,
        "SHP": 1.336226,
        "SLL": 15958.246,
        "SOS": 551.5011,
        "SRD": 27.254139,
        "STD": 20079.238,
        "SVC": 8.490239,
        "SYP": 2437.4211,
        "SZL": 17.665894,
        "THB": 36.74714,
        "TJS": 9.848356,
        "TMT": 3.395372,
        "TND": 3.181466,
        "TOP": 2.377051,
        "TRY": 18.022339,
        "TTD": 6.587774,
        "TWD": 30.934263,
        "TZS": 2262.2876,
        "UAH": 35.83553,
        "UGX": 3721.007,
        "USD": 0.970106,
        "UYU": 39.85438,
        "UZS": 10765.682,
        "VND": 23365.008,
        "VUV": 120.66859,
        "WST": 2.745615,
        "XAF": 655.0698,
        "XAG": 0.051099,
        "XAU": 0.000581,
        "XCD": 2.621761,
        "XDR": 0.760063,
        "XOF": 655.0631,
        "XPF": 119.80637,
        "YER": 242.7695,
        "ZAR": 17.773705,
        "ZMK": 8732.122,
        "ZMW": 15.40378,
        "ZWL": 312.37378
    },
    "success": true,
    "timestamp": 1665639652
}

To Reproduce
Steps to reproduce the behavior:

  • Call url ...
  • Provide json you are submitting to the service (if it applies)
  • Links to issues in other repos (if possible)

Error message

safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:09Z INFO  safe_client_gateway::monitoring::performance] MT::GET::/v1/chains/<chain_id>/safes/<safe_address>/transactions/history?<cursor>&<timezone_offset>::533::200::/v1/chains/111/safes/0x81c0D23f50cA760eB134dd131DA24F392492140A/transactions/history::322
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:09Z INFO  _] Response succeeded.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  rocket::server] GET /v1/balances/supported-fiat-codes:
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Matched: (get_supported_fiat) GET /v1/balances/supported-fiat-codes
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z DEBUG reqwest::connect] starting new connection: https://<my exchange data service domain>
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z DEBUG reqwest::async_impl::client] response '200 OK' for https://<my exchange data service domain>/latest?access_key=xxx
safe-infrastructure-cgw-web-1    | thread 'rocket-worker-thread' panicked at 'swap_remove index (is 1) should be < len (is 1)', library/alloc/src/vec/mod.rs:1306:13
safe-infrastructure-cgw-web-1    | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z ERROR _] Handler get_supported_fiat panicked.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] This is an application bug.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] A panic in Rust must be treated as an exceptional event.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Panicking is not a suitable error handling mechanism.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Unwinding, the result of a panic, is an expensive operation.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Panics will degrade application performance.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Instead of panicking, return `Option` and/or `Result`.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Values of either type can be returned directly from handlers.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z WARN  _] A panic is treated as an internal server error.
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z INFO  _] Outcome: Failure
safe-infrastructure-cgw-web-1    | [2022-10-13T05:20:13Z WARN  _] Responding with registered (panic) 500 catcher.
@mhxw mhxw added the bug Something isn't working label Oct 13, 2022
@fmrsabino
Copy link
Contributor

Apologies for only replying to this issue right now. The team was rewriting the service and it is available now under https://github.com/safe-global/safe-client-gateway-nest.

I'm closing the issue as it seems that it no longer applies but if you find any issue with the new implementation feel free to open a new ticket there!

@fmrsabino fmrsabino closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants