DefiLlama/users-server

i got some error adaptor llamapay

Closed this issue · 4 comments

ts-node test.js llamapay
time zone GMT+0700 (Indochina Time)

Internal Error: `res` returned different dates
[
 {
   ethereum: { day: 2022-08-13T00:00:00.000Z, total_users: 3, unique_users: 2 },
   avax: { day: 2022-08-13T00:00:00.000Z, total_users: 5, unique_users: 5 },
   fantom: { day: 2022-08-13T00:00:00.000Z, total_users: 4, unique_users: 4 },
   polygon: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
   arbitrum: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
   bsc: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
   optimism: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
   xdai: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 }
 },
 {
   ethereum: { day: 2022-08-11T00:00:00.000Z, total_users: 11, unique_users: 8 },
   avax: { day: 2022-08-11T00:00:00.000Z, total_users: 3, unique_users: 3 },
   fantom: { day: 2022-08-11T00:00:00.000Z, total_users: 2, unique_users: 2 },
   polygon: { day: 2022-08-10T17:00:00.000Z, total_users: 0, unique_users: 0 },
   arbitrum: { day: 2022-08-10T17:00:00.000Z, total_users: 0, unique_users: 0 },
   bsc: { day: 2022-08-10T17:00:00.000Z, total_users: 0, unique_users: 0 },
   optimism: { day: 2022-08-10T17:00:00.000Z, total_users: 0, unique_users: 0 },
   xdai: { day: 2022-08-10T17:00:00.000Z, total_users: 0, unique_users: 0 }
 },
 {
   ethereum: { day: 2022-08-04T00:00:00.000Z, total_users: 4, unique_users: 4 },
   avax: { day: 2022-08-04T00:00:00.000Z, total_users: 4, unique_users: 4 },
   fantom: { day: 2022-08-04T00:00:00.000Z, total_users: 2, unique_users: 1 },
   polygon: { day: 2022-08-03T17:00:00.000Z, total_users: 0, unique_users: 0 },
   arbitrum: { day: 2022-08-03T17:00:00.000Z, total_users: 0, unique_users: 0 },
   bsc: { day: 2022-08-03T17:00:00.000Z, total_users: 0, unique_users: 0 },
   optimism: { day: 2022-08-03T17:00:00.000Z, total_users: 0, unique_users: 0 },
   xdai: { day: 2022-08-03T17:00:00.000Z, total_users: 0, unique_users: 0 }
 },
 {
   ethereum: { day: 2022-06-25T00:00:00.000Z, total_users: 5, unique_users: 4 },
   avax: { day: 2022-06-24T17:00:00.000Z, total_users: 0, unique_users: 0 },
   fantom: { day: 2022-06-24T17:00:00.000Z, total_users: 0, unique_users: 0 },
   polygon: { day: 2022-06-24T17:00:00.000Z, total_users: 0, unique_users: 0 },
   arbitrum: { day: 2022-06-24T17:00:00.000Z, total_users: 0, unique_users: 0 },
   bsc: { day: 2022-06-25T00:00:00.000Z, total_users: 1, unique_users: 1 },
   optimism: { day: 2022-06-24T17:00:00.000Z, total_users: 0, unique_users: 0 },
   xdai: { day: 2022-06-24T17:00:00.000Z, total_users: 0, unique_users: 0 }
 }
]

debug

{
  ethereum: { day: 2022-08-13T00:00:00.000Z, total_users: 3, unique_users: 2 },
  avax: { day: 2022-08-13T00:00:00.000Z, total_users: 5, unique_users: 5 },
  fantom: { day: 2022-08-13T00:00:00.000Z, total_users: 4, unique_users: 4 },
  polygon: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
  arbitrum: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
  bsc: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
  optimism: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 },
  xdai: { day: 2022-08-12T17:00:00.000Z, total_users: 0, unique_users: 0 }
}
Set(2) { 1660348800000, 1660323600000 }
Internal Error: `res` returned different dates

fixed by

export TZ='Etcnode\Universal'
ts-node test.js llamapay

Thanks for reporting, it seems like there is a bug due to not verifying timezones in the code, I'll add explicit UTC timezone casts where needed.

I'll keep this issue open for now, till PR #1 is merged which should be some time next week.

so thank!!