Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live Events Accessible via /graphql But Missing in Database #1190

Open
abtestingalpha opened this issue Oct 25, 2024 · 3 comments
Open

Live Events Accessible via /graphql But Missing in Database #1190

abtestingalpha opened this issue Oct 25, 2024 · 3 comments

Comments

@abtestingalpha
Copy link

abtestingalpha commented Oct 25, 2024

Problem

  • Version: 0.6.20
  • DB: Issue exists both on SQLite and Postgres
  • Networks: Ethereum Sepolia, Arbitrum Sepolia, and Avalanche Fuji Testnet

New Events: When new events come in while the Ponder server is running:

  • They seem to be indexed, as they are accessible via the /graphql endpoint.
  • However, these new events do not appear in the database, even though they should be there.
  • After dropping the database table and reindexing, all past events are successfully indexed and appear in the database.

This leads to failures in API functions that depend on database lookups, as they cannot find the newly indexed events.

Expected Behavior

  • Any new events should not only be visible via the /graphql endpoint but should also be written to the database as they come in.
  • All indexed events (both old and new) should be available for queries through API functions that perform database lookups.
@typedarray
Copy link
Collaborator

Thanks for opening. Can you clarify from where and when you're running SQL queries against the database? It sounds like this is running within an API function, correct? Did you notice this when using ponder dev, start, or serve?

The GraphQL API is powered by SQL queries using the exact same database connection pool as the API function context, so this is strange. One idea - maybe there is some kind of caching going on at some point in the request cycle here?

@abtestingalpha
Copy link
Author

Running ponder start. The SQL queries are run from API functions, correct, but even manually inspecting the DB shows the events don't exist. For example, if I inspect the local db in .ponder the event doesn't exist. Similarly, if I pull down the DB from Railway, the event doesn't exist. Once I rerun ponder start and the former live events are treated as historical, they get into the DBs.

@typedarray
Copy link
Collaborator

Hmm. Are you absolutely certain that these events are accessible via GraphQL? If they are not present when manually inspecting the database, my best guess is that this as an indexing / "missing events in realtime" bug. But if they are being returned from GraphQL, that's very puzzling.

Regardless, to make more progress we'll likely need a minimal reproduction or access to your app so we can run it and try to reproduce. Please share here or reach out in Telegram DMs if sensitive.

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

No branches or pull requests

2 participants