【发布时间】:2021-03-03 18:35:19
【问题描述】:
我正在尝试使用 AWS 放大 GraphQL 订阅,如下所示,
import Amplify,{ API, Storage, graphqlOperation } from "aws-amplify";
import awsmobile from "../../aws-exports";
Amplify.configure(awsmobile);
...
const notiSubscription = API.graphql(graphqlOperation(onCreateNotification)).subscribe({
next: (todoData) => {
console.log(todoData);
},
});
...
onCreateNotification Graphql 是,
subscription OnCreateNotification {
onCreateNotification {
id
}}
以下是我得到的错误,
AWSAppSyncProvider.ts:204 Uncaught (in promise) undefined
rejected @ AWSAppSyncProvider.ts:204
Promise.then (async)
step @ AWSAppSyncProvider.ts:204
(anonymous) @ AWSAppSyncProvider.ts:204
push../node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js.__awaiter @ AWSAppSyncProvider.ts:204
AWSAppSyncRealTimeProvider._startSubscriptionWithAWSAppSyncRealTime @ AWSAppSyncRealTimeProvider.ts:227
(anonymous) @ AWSAppSyncRealTimeProvider.ts:185
Subscription @ Observable.js:197
subscribe @ Observable.js:279
(anonymous) @ PubSub.ts:171
...
请帮帮我,我的配置也是
"aws_project_region": "us-east-1",
"aws_appsync_graphqlEndpoint": "https://xxx.appsync-api.us-east-1.amazonaws.com/graphql",
"aws_appsync_region": "us-east-1",
"aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
"aws_appsync_apiKey": "xxxx",
【问题讨论】:
标签: javascript reactjs graphql aws-amplify aws-appsync