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

Bug: [pglite-sync] offset defined as undefined_undefined #541

Open
gartz opened this issue Feb 14, 2025 · 0 comments
Open

Bug: [pglite-sync] offset defined as undefined_undefined #541

gartz opened this issue Feb 14, 2025 · 0 comments

Comments

@gartz
Copy link

gartz commented Feb 14, 2025

Discussed in #540

Originally posted by gartz February 13, 2025

Bug Report: syncShapeToTable Offset Issue

Summary

When using syncShapeToTable, the initial sync request uses the correct offset 0_inf. However, on subsequent loads—when the client's database already exists—the offset becomes undefined_undefined, causing the sync process to abort without any retries.

Details

  • Error Message:

    FetchError: HTTP Error 400 at x://x?columns=id%2Cnote%2Cuser_id%2Ccreated_at&handle=59017170-1739512915570&offset=undefined_undefined&table=notes: {"message":"Invalid request","errors":{"offset":["has invalid format"]}}
  • Electric Backend Log:

    15:37:49.792 pid=<0.4138.0> request_id=GCQdNQ7qX1cBspoAABeD [info] GET /v1/shape
    15:37:49.793 pid=<0.4138.0> request_id=GCQdNQ7qX1cBspoAABeD [info] Query String: handle=59017170-1739512915570&offset=undefined_undefined&table=notes&columns=id%2Cnote%2Cuser_id%2Ccreated_at

Observations

  • The issue occurs on the second load, during the resume of sync when the client's database already exists.
  • Clearing browser data or resetting the Electric backend cache does not resolve the problem.
  • Changing the useCopy property (both true and false) does not affect the behavior.
  • Manually replacing undefined_undefined with a value like 0_0 results in primary key constraint violations, which suggests the root of the issue lies in the syncShapeToTable implementation.

Request for Assistance

Any guidance on the next steps to trace and resolve this issue would be greatly appreciated. Additionally, including source maps in the npm package would significantly ease debugging.

Thank you!

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

1 participant