Comments (11)
I think I know whats happing, Zod seems to have changed how it validates UUIDs, version 3.22.4 correctly validates UUID V7 whereas 3.21.4 (currently specified by Electric) rejects them.
I forked your sandbox and changed the Zod version to match that in your projects package_lock.json and it rejects them: https://codesandbox.io/p/sandbox/js-playground-forked-dvtnl3?file=%2Fsrc%2Findex.js
We obviously need to change the version of Zod that's specified. @kevin-dp could you take a look, I know you had concerns about Zod versions before?
from electric.
We pinned Electric to Zod version 3.21.1 because something changed in later versions of Zod that can cause the generated client to contain type errors, cf. #700 for more information.
from electric.
VAX-1781 Suddenly only raw queries work
from electric.
I now built a branch of the app where there are no references to other tables in app_states.
unrecognized keys
does not appear in the errors any more. But Invalid uuid
is still claimed.
Also: The query for projects does (still) not return any data either...
from electric.
I now built another branch of the app. This time the user_email is the primary key of the app_states table. Thus there is no way there could be an offending uuid.
This would probably not work for the app but I just built this to test this issue.
What is nice:
- no error is thrown
- app_states are correctly queried
BUT:
- no other data is queried using typed queries (all use an uuid primary key)
- using raw queries, other data is returned. As before with the app_states
- even though no data is returned, no error is thrown
So now I am completely at a loss how to get my project working again 🤷
Well, asides from refactoring all 982 queries to use raw versions...
This project has always been using v7 uuids. Is it possible that this (suddenly) causes an issue?
from electric.
I now built another branch of my project.
This time all uuid's were converted to text.
And the queries work again.
So it really seems that the uuid's are the culprit?
from electric.
So I now built a branch of the project using uuid v4 instead of uuid v7. It works!
So my interpretation is that there must be a place in the implementation of electric-sql / prisma or whatever that checks the validity if uuid's and unfortunately rejects v7 uuid's.
This must be new as my app has been using them for months and so far it has worked.
By the way, to create uuid v7 I was using:
- in code: @kripod/uuidv7 version 0.3.4
- for test data: https://www.uuidgenerator.net/version7. It seems they use uuidv7 to generate the v7 uuid's (https://www.uuidgenerator.net/dev-corner/javascript)
from electric.
It seems that zod is not the culprit. I tested two of my v7 uuid's here: https://codesandbox.io/p/sandbox/js-playground-forked-dvtnl3?file=%2Fsrc%2Findex.js%3A7%2C33 (watch the values logged in dev tools)
from electric.
YESSSSSS!
I installed the current version of zod in my project and now the v7 uuid's are working just fine.
Thanks so much @samwillis
from electric.
So it seems we are all waiting for a new version of zod as the last one happened in oktober 2023 and a (hopefully) solution was merged three weeks ago.
from electric.
@kevin-dp could we have a clearer section in our docs about pinned dependencies? I.e.: "you must use the pinned versions of these libraries ...".
from electric.
Related Issues (20)
- when select where item contains in json array, array_constiains key not recognize, how to filter if json type constains element HOT 2
- Can't load data when phone is offline in Expo app HOT 5
- [BUG] Syntax error CREATE_REPLICATION_SLOT when install electric-sql with docker HOT 8
- MODULE ERROR: Electric.Replication.PostgresConnector HOT 5
- Possible issue in the new ShapeManager code. HOT 3
- SQLite/PGLite not fully compatible with NextJS HOT 4
- Inactive replication slot causing warnings on DO managed Postgres HOT 6
- Demo example with PostGis plugin?? HOT 1
- Error: FOREIGN KEY constraint failed HOT 4
- [rpc] recv: #SatInStartReplicationResp{`Error: Cannot catch up to the server's current state`} HOT 1
- Unable to install electric-sql on MacOS & Node@22 HOT 2
- Zod rejects UUIDs that Postgres deems valid HOT 1
- `(FunctionClauseError) no function clause matching in Electric.Postgres.Extension.SchemaCache.name/1` HOT 7
- too many arguments on function json_object HOT 2
- Issue with ElectricSQL when I try to change the content of an entry in the database HOT 3
- tauri-sqlite example start failed HOT 2
- Secure auth invalid key HOT 6
- Checkout and Linear example not working (client side issue) HOT 1
- Sync service complains about multiple connections from the same client HOT 1
- Fly deploy (launch) of Quickstart app fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electric.