amplify-js: Subscription not working with filter
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React
Amplify APIs
GraphQL API
Amplify Categories
api
Environment information
Nothing
Describe the bug
I created the @model in graphql and it created the mutation and subcriptions. Also I created the custom subscription based on my requirements.
The problem is default subscription is working with filter and without filter. But my custom subscription is not working with filter but it’s working without filter.
Please help me to resolve this issue.
The above scenario is only working in local env which is runningamplify push cli command.
After merged the local code into git branch, In the Amplify Hosting build is not working for all subscriptions with filter(default and custom) but it’s working without filter.
Custom subscription in schema.graphql:
type MyEvents
@model(timestamps: null)
@auth(rules: [{allow: private}])
{
event_id: ID! @primaryKey(sortKeyFields: ["version"])
version: Int!
status: String!
merchant_id: Int!
event_name: String
event_type: String
}
input MyEventsFilterInput{
status: CustomSubscriptionStringInput
merchant_id: CustomSubscriptionIntInput
event_type: CustomSubscriptionStringInput
}
type Subscription {
onCreateCustomMyEvents(filter: MyEventsFilterInput): MyEvents
@aws_subscribe(mutations: ["createMyEvents"])
}
Subscriptions.js:
My Custom Subscription:
export const onCreateCustomMyEvents= /* GraphQL */ `
subscription OnCreateCustomMyEvents($filter: MyEventsFilterInput) {
onCreateCustomMyEvents(filter: $filter) {
event_id
version
status
merchant_id
event_type
}
}
`;
Default Subscription:
export const onCreateMyEvents = /* GraphQL */ `
subscription OnCreateMyEvents(
$filter: ModelSubscriptionMyEventsFilterInput
) {
onCreateMmpUserEvents(filter: $filter) {
event_id
version
status
merchant_id
event_type
}
}
`;
Expected behavior
Please help me to resolve subscription with filter amplify cli buld and amplify hosting build.
Reproduction steps
Nothing
Code Snippet
// Put your code below this line.
Graphql code
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 20 (10 by maintainers)
@david-mcafee My issue is filter is not working and i resolved the path error issue.