Skip to content

Conversation

@LoneExile
Copy link

1. Fixed timestamp format conversion

Before:

const requestBody = {
  filter: {
    query,
    from: `${from * 1000}`,  // Wrong - sends string "1730097055000"
    to: `${to * 1000}`,
  },
}

After:

// Convert epoch seconds to ISO 8601 format
const fromISO = new Date(from * 1000).toISOString()
const toISO = new Date(to * 1000).toISOString()

const response = await apiInstance.listLogs({
  body: {
    filter: {
      query,
      from: fromISO,  // Now sends "2025-10-28T06:30:55.000Z"
      to: toISO,
    },
    page: { limit },
    sort: '-timestamp',
  },
})

2. Added timestamp validation

Added validateTimestamps() function that checks:

  • Timestamps are valid finite numbers
  • from is before to
  • Timestamps are not in the future (with 5-minute buffer for clock skew)
  • Warns if querying very old logs (>1 year)

Provides helpful error messages:

Invalid 'from' timestamp: 2025-10-28T14:14:10.000Z is in the future.
Current time: 2025-10-28T10:14:21.000Z. Please check your timestamp calculation.

Related Issues

Fixes #22

@LoneExile LoneExile requested a review from winor30 as a code owner October 28, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get all logs returns nothing

1 participant