-
Notifications
You must be signed in to change notification settings - Fork 867
Filters/where for on DELETED subscription don't work #3272
Comments
Just trying it on Docker image prismagraphql/prisma:1.17.2 |
This is a duplicate of #2847, which seems to be a regression. |
I think this issue wasn't related to #2847 sure, the id was wrong but there seems to be a problem with the filtering on the node of the subscription when deleting. Now the id is returned correctly but the something is not right with the where filters on the node. I have a subscription with filtering on the node and When I subscribe with different parameters, on create only the correct filtered subscriptions get notified, and I get the data on the client no problem. But when a record is deleted all of the subscriptions get notified regardless of the filter set on the node parameter. I tested it several times, for example when I called the subscription 6 times with different filters, on create only 1 with the right filters set got notified, but when deleted the same node all of the 6 subscriptions got notified and received data on the client, sure on the other 5, the id didn't match anything in the cache of the related query, so nothing got removed, but code needlessly run 5 other times. It would be nice to know what causes this, and fix it, so there will be no useless network calls. my subscription code:
the queryDate is called with type ALL so dates don't matter on subscriptions as we only want the newest ones anyway versions: Is the problem on my end, or maybe in Prisma code? @marktani can you reopen this issue for discussion please? |
Writing a comment just to inform I am experiencing the same problem as @Sampite. CREATED/UPDATED notifications are filtered properly, but DELETE subscriptions seem to not properly apply such filters. |
Hey @AlejandroRodarte, Still, there seems to be something wrong with Prismas delete subs. And as I did not get any response regarding the issue in this thread, maybe if you have the time and interested in solving it, create a new issue on this and reference this thread maybe. Anyway Prisma2 will be production ready "soon" so maybe it doesn't worth the effort. |
@Sampite & @AlejandroRodarte Something very similar to you happens to me. On my server (localhost: 8000) subscriptions have strange behavior. When I try to filter with "{where: {node: {...}}}" nothing works, just the subscription stays "Listening ...". And when I remove the filters "node" works! This means that "mutations_in [...]" works! On the other hand, subscriptions with filters "node" on the Prisma server (localhost: 4466 --on docker--) works! It's my second day diving all over the Prisma forum and other pages, and I can't find any solution. I think I will follow the @Sampite solution. Although I think I will create a thread after hearing your suggestions. Here a bit of my code:
|
@BiosTEC On an other note, as prisma is in a weird place because prisma2 is not production ready yet, and I needed some solutions that prisma1 cant handle, and I'm working with a full Typescript project. I'm in the process of rewriting my server code and moving to TypeGraphQL + TypeORM so i don't have to define the schema 2times and other handy stuff with decorators. Maybe if you cant solve all your problems and can't wait till prisma2 its worth to check out this stack, and I'm still using Apollo server/client for graphql |
Wow! When I was reading about how it works under the hood how subscriptions work, I saw that there were different libraries with anchors to servers such as redis, RabbitMQ, Google PubSub etc., which give the pubSub system greater stability. I think Prisma works with RabbitMQ, am I correct? I will ask you a couple of questions since I am a new one within the framework of Prisma,
Thanks for everything! |
Describe the bug
Subscription on DELETED event fires always despite of filters
To Reproduce
Steps to reproduce the behavior:
Run any subscription and will try to use filters for node field. After that delete something (that not in filter) and you will get notify despite of filters
Expected behavior
Filters is work
Screenshots
If i use playground on graphql-yoga api
Same on prisma api
Versions (please complete the following information):
package.json of my graphql-yoga server
Subscription is just forwarding to prisma
graphql-cli
,prisma-binding
,graphql-yoga
, etc. if applicableAdditional context
P.S.
Also as you can see i have strange value in previousValue.id
CuidGCValue(cjmyxtna300pi0936kx8fimgz)
But i think for this i need to create another issue? Or is this expected format of id?
The text was updated successfully, but these errors were encountered: