-
Notifications
You must be signed in to change notification settings - Fork 657
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
Using WebSocketNetworkTransport throws IllegalArgumentException: Flow has more than one element
#6276
Comments
Hi 👋 Can you share the code you're using to start the subscription and collect the Flow? |
Hey, sorry for the delay over the weekend, here is the code
|
Thanks! I can reproduce. This is indeed a subscriptions/persisted queries integration issue. Apologies for the inconvenience, I'll make a fix for that. In the meantime, you can disable persisted queries for your subscriptions like so: client.subscription(subscription)
.enableAutoPersistedQueries(false)
.toFlow() |
@martinbonnin Thank you for the update, we should be fine disabling PQ for subscriptions for a while, would you have an idea when would the fix be out and in which release? |
Just for clarifying: I don't think v2 ever supported APQs + subscriptions. It's just silently disabled, which is what I was looking into porting to v3/v4. |
v2 has a toggle
Not really, we had that option disabled for v2 but as the API was present and if the need arises to enable it, wanted to know when would the fix be available |
TBH, I don't know any server that supports it. We could maybe find a way but to make it work but it'd probably be useless without a matching server. |
Out of curiosity, what stack is your server? I'm curious if it supports that. |
I believe to enable safe-list PQs (PQs manually uploaded to the server) we use the same toggle |
Our backend doesn't support APQ as of now. Sorry if I confused you. |
No worries, APQs vs PQs is confusing.
If you're using Apollo Router indeed, other backends may work differently. But judging by your |
Related to the above ☝️, Sorry I meant on the client side (Android), whether we use APQ or PQ the only way to enable PQ is using the |
Apollo 2 has never supported APQs or PQs with subscriptions. It was disabled under the hood. You could call The "quick" fix is to do the same in Apollo 3 but since we're on that topic, I'll look into what it takes to add proper support, stay tuned. |
Okay great, thank you for the help @martinbonnin |
@akashamin a fix for APQs + HTTP multipart subscriptions is available in #6283. I'm not 100% sure that'll work for your use case though. What are you using on the backend? |
Thank you for the quick fix. We are soon going to migrate HTTP multipart subscriptions but currently we use traditional web sockets. |
How much do you need APQs/PQs with traditional WebSockets? |
That's okay we won't need PQs with websockets as of now, as I mentioned we never had it enabled on Apollo2, it was just a question of if the need arises what should be done. Though I'll get back to you on our backend stack will need to ask them. |
Version
3.8.5
Summary
We are currently working on a migration from Apollo2 to Apollo3 and see a bunch of
IllegalArgumentException: Flow has more than one element
thrown when receiving updates through webSocket.ApolloClient builder code below
I found an old issue related to the same exception, when I remove
autoPersistedQueries
I don't see the exception, not sure if this is a configuration issue on our end or a bug in the library.Steps to reproduce the behavior
No response
Logs
The text was updated successfully, but these errors were encountered: