Issue Description
The currencyservice is experiencing conversion errors that result in zero amounts when converting to/from GBP (British Pound Sterling). This causes the service to fall back to the original currency and triggers error logging.
Root Cause Analysis
After analyzing the pod logs, I found repeated error messages:
"Currency conversion resulted in zero amount, switching back to original currency"
Upon examining the source code in src/currencyservice/server.js and the exchange rate data in src/currencyservice/data/currency_conversion.json, I discovered that the GBP entry has an empty value:
When the conversion logic divides by this empty string, it results in zero amounts, triggering the error handling code that reverts to the original currency.
Impact
- Currency conversions involving GBP fail
- Error messages flood the logs
- Users cannot successfully convert prices to/from British Pounds
- Service reliability is compromised for UK users
Recommended Fix
Update the src/currencyservice/data/currency_conversion.json file to include a proper exchange rate for GBP. Based on the other rates in the file (which appear to be EUR-based), a reasonable value would be approximately:
This represents the historical EUR to GBP conversion rate that aligns with the other rates in the dataset.
Additional Considerations
- Consider adding validation logic to prevent empty or invalid exchange rates
- Implement proper error handling that doesn't silently fall back but instead returns meaningful error messages
- Add monitoring alerts for conversion failures
- Consider using a real-time currency API for more accurate and up-to-date exchange rates
Issue Description
The currencyservice is experiencing conversion errors that result in zero amounts when converting to/from GBP (British Pound Sterling). This causes the service to fall back to the original currency and triggers error logging.
Root Cause Analysis
After analyzing the pod logs, I found repeated error messages:
Upon examining the source code in
src/currencyservice/server.jsand the exchange rate data insrc/currencyservice/data/currency_conversion.json, I discovered that the GBP entry has an empty value:When the conversion logic divides by this empty string, it results in zero amounts, triggering the error handling code that reverts to the original currency.
Impact
Recommended Fix
Update the
src/currencyservice/data/currency_conversion.jsonfile to include a proper exchange rate for GBP. Based on the other rates in the file (which appear to be EUR-based), a reasonable value would be approximately:This represents the historical EUR to GBP conversion rate that aligns with the other rates in the dataset.
Additional Considerations