Subscription filter not working
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
For the following simple example:
@Subscription(returns => Object, {
filter: (payload: any, variables: any) => {
console.log('payload', payload);
console.log('variables', variables);
return true;
},
})
objectAdded() {
return pubSub.asyncIterator<Station>('objectAdded');
}
Got the following result:
TypeError: asyncIterator.return is not a function
Because in https://github.com/nestjs/graphql/blob/master/lib/services/resolvers-explorer.service.ts
-> createSubscriptionMetadata
, when filter
is present the method withFilter
is called with a promise as parameter instead of AsyncIterator.
Expected behavior
No error should occur.
Minimal reproduction of the problem with instructions
@Subscription(returns => Object, {
filter: (payload: any, variables: any) => {
console.log('payload', payload);
console.log('variables', variables);
return true;
},
})
objectAdded() {
return pubSub.asyncIterator<Station>('objectAdded');
}
What is the motivation / use case for changing the behavior?
Cannot update the project from 5.x to 6.x.
Environment
Nest version: 6.0.1
For Tooling issues:
- Node version: v10.15.0
- Platform: Mac
Others:
The project is a NX one.
Issue Analytics
- State:
- Created 5 years ago
- Comments:24 (7 by maintainers)
Top Results From Across the Web
Troubleshoot subscription filter policy issues in Amazon SNS
Subscription filter policies can filter message attributes only, not the message body. If the MessageAttributeValue is left empty on a ...
Read more >Amazon SQS subscription filters not working · Issue #1761
The goal is to setup SQS/SNS to have a consumer that only processes message that fit a certain criteria. I can find examples...
Read more >AWS SNS Subscription Filter policy checking a key in ...
I would like to use a filter subscription policy that ignores the second type but passes the first type to the subscriber. So...
Read more >Search Subscription filter not working with eCommerce ...
The Subscription filter in Search preferences is not associated with the eCommerce Subscription functionality. Instead, this filter is ...
Read more >Subscriptions filter in AAD and Azure portal are not in sync
While in the meantime, my account has Owner access to various Azure Subscriptions. Well, after lot of troubleshooting with Microsoft Support, it ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A temp resolution for
Code first
style subscription. You need an asyncInterator filter function:asyncFilter
implement below (pay attention it’s NOT same aswithFilter
from ‘graphql-subscriptions’):i got the same result #182 the filter function doesn’t run