- Newest
- Most votes
- Most comments
Hi, I got a confirmation from AppSync development team that the limit of 5 unique fieldName is per subscription field and not per filter. The team has confirmed that they will will update the documentation to reflect this. However we cannot comment on thr ETA for the changes to reflect.
Hello,
I tried to relicate this with a sample schema :
enum Priority {
none
lowest
low
medium
high
highest
}
type Ticket {
id: ID
createdAt: AWSDateTime
content: String
severity: Int
priority: Priority
category: String
group: String
status: String
}
input TicketInput {
content: String
severity: Int
priority: Priority
category: String
group: String
}
type Mutation {
createTicket(input: TicketInput): Ticket
}
type Query {
getTicket(id: ID!): Ticket
}
type Subscription {
onSpecialTicketCreated: Ticket
@aws_subscribe(mutations: ["createTicket"])
onGroupTicketCreated(group: String!): Ticket
@aws_subscribe(mutations: ["createTicket"])
}
Added the resolver code as :
import { util, extensions } from '@aws-appsync/utils';
export function request(ctx) {
// simplfy return null for the payload
return { payload: null };
}
export function response(ctx) {
const filter = {
or: [
{ severity: { ge: 7 }, category: {eq : 'AWS AppSync'}, priority: { in: ['high', 'medium', 'none', 'lowest', 'low','highest'] } },
{ category: { eq: 'security' }, priority: { in: ['high', 'medium', 'none', 'lowest', 'low','highest'] } },
],
};
extensions.setSubscriptionFilter(util.transform.toSubscriptionFilter(filter));
// important: return null in the response
return null;
}
which is similar to your setup however I was not able to reproduce this. Can you please share the number of items in the 'in' operator? The limit is 5
Also, this might require account specific investigation, hence you may consider reaching out to AWS Support, directly.
Hello, thanks for the comment! I think my issue isn't with the
inoperator, but moreso a five field requirement I am confused about. My examples all used only one element in theinoperator. It's possible I'll need to reach out to AWS directly. In your example, you are using 3 unique fields in your overall filter (severity,category, andpriority). There should be no issue with that, but I think I get an error when there are more than 5 unique fields even when they are not directly AND'd. So with your example, each object in the OR array would need to have 3 fields to filter on each, and each one of those fields should be unique, so no duplicates.

Thanks for reaching out for the clarification!