amplify-cli: Mutations not triggering subscriptions
Describe the bug Using the Amplify GraphQL Client to subscribe to a subscription and call a mutations does not result in a socket notification via the subscription
Amplify CLI Version 4.21.1
To Reproduce
const createTest = /* GraphQL */ '
mutation CreateTest($input: CreateTestInput!) {
createTest(input: $input) {
__typename
id
}
}
'
useEffecct(() => {
API.graphql(graphqlOperation(createTest, { input: { id: (new Date()).toISOString(), name: (new Date()).toISOString() }}))
.then(console.log) <==== successfully called
.catch(console.log)
}, [])
useEffect(() => {
API.graphql(graphqlOperation(`subscription OnCreateTest {
onCreateTest {
__typename
id
}
}`))
.subscribe({
next: (todoData) => { /// <==== this is NEVER called
console.log("todoData", todoData);
},
error: console.log, /// <==== this is NEVER called
})
}, [])
Expected behavior Calling the mutation should result in the subscripting firing
Desktop (please complete the following information):
- OS: Mac
Additional context
type Test
@model(subscriptions: { level: public })
{
id: ID!
name: String!
}
const awsmobile = {
"aws_project_region": "us-east-1",
"aws_cognito_identity_pool_id": "xxxxxxx",
"aws_cognito_region": "us-east-1",
"aws_user_pools_id": "xxxxxxx",
"aws_user_pools_web_client_id": "xxxxxxx",
"oauth": {},
"aws_appsync_graphqlEndpoint": "https://xxxxxxx.appsync-api.us-east-1.amazonaws.com/graphql",
"aws_appsync_region": "us-east-1",
"aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
"aws_cloud_logic_custom": [
{
"name": "AdminQueries",
"endpoint": "https://xxxxxxx.execute-api.us-east-1.amazonaws.com/staging",
"region": "us-east-1"
}
],
"aws_mobile_analytics_app_id": "xxxxxxx",
"aws_mobile_analytics_app_region": "us-east-1",
"aws_user_files_s3_bucket": "xxxxxxx",
"aws_user_files_s3_bucket_region": "us-east-1"
};
export default awsmobile;
import awsmobile from './aws-exports';
Amplify.configure(awsmobile);
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (8 by maintainers)
Uh. Sure. Done: https://www.dropbox.com/s/io7e91f9fwofgiz/Screenshot 2020-07-07 08.45.36.png?dl=0
What’s your advice for anyone who isn’t pay for support?