Closed yukitaka13-1110 closed 5 years ago
Hey @yukitaka13-1110,
Are you using the API category for graphql subscriptions? Also, can you post which versions of amplify modules you are using.
@jordanranz Sorry for lating response.
My package.json is as follows
"dependencies": {
"@aws-amplify/cli": "^1.7.2",
"@aws-amplify/ui": "^1.0.20",
"@types/graphql": "^14.2.0",
"@types/zen-observable": "^0.8.0",
"aws-amplify": "^1.1.29",
"aws-amplify-vue": "^0.2.12",
"aws-sdk": "^2.479.0",
"core-js": "^2.6.5",
"register-service-worker": "^1.6.2",
"rxjs-compat": "^6.5.2",
"vue": "^2.6.10",
"vue-class-component": "^7.0.2",
"vue-property-decorator": "^8.1.0",
"vue-router": "^3.0.3",
"vuetify": "^1.5.5",
"vuex": "^3.0.1"
},
"devDependencies": {
"@types/jest": "^23.1.4",
"@types/node": "^12.0.3",
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-e2e-cypress": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-plugin-pwa": "^3.8.0",
"@vue/cli-plugin-typescript": "^3.8.0",
"@vue/cli-plugin-unit-jest": "^3.8.0",
"@vue/cli-service": "^3.8.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/eslint-config-typescript": "^4.0.0",
"@vue/test-utils": "1.0.0-beta.29",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"lint-staged": "^8.1.5",
"sass": "^1.18.0",
"sass-loader": "^7.1.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"ts-jest": "^23.0.0",
"typescript": "3.4.5",
"vue-cli-plugin-pug": "^1.0.7",
"vue-cli-plugin-vuetify": "^0.5.0",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.0.5"
},
My import
import API, { graphqlOperation } from '@aws-amplify/api'
import Auth from '@aws-amplify/auth'
import Storage from '@aws-amplify/storage'
// @ts-ignore
import { S3Image } from 'aws-amplify-vue/src/components/storage'
import router from '@/router'
import * as APITypes from '../API'
import { createXXX, deleteXXX, updateXXX } from '../graphql/mutations'
import { GraphQLResult } from '@aws-amplify/api/lib/types'
import { listXXX, getXXX } from '../graphql/queries'
import { onCreateXXX, onDeleteXXX, onUpdateXXX } from '../graphql/subscriptions'
import Vue, { PropType } from 'vue'
import Observable from 'zen-observable'
GraphQL subscription
const createSubscription = API.graphql(graphqlOperation(onCreateXXX))
if (createSubscription instanceof Observable) {
createSubscription.subscribe({
next: ({
value: {
data: { onCreateXXX: createItem }
}
}: {
value: {
data: { onCreateXXX: APITypes.CreateXXXInput }
}
}) => {
console.log(createItem)
this.XXXXX.push(createItem)
}
})
}
I have the same issue, with the api category it uses pubsub for subscriptions, but amplify doesn't generate any config for it?
@yukitaka13-1110 Could you confirm if you still have this issue.
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
I encountered a problem as follows issue https://github.com/aws-amplify/amplify-js/issues/3484
And I tried to change aws-amplify import statement following this solution
I solved it but I got another error as follows
I don't use PubSub in .vue file. Perhaps, it was triggered by limiting import. What should I do ?