реагировать, aws appsync, apollo connect / query - ошибка GraphQL: истекло время ожидания выполнения - PullRequest
0 голосов
/ 25 февраля 2019

привет, я пытаюсь подключиться и запросить данные с сервера aws appsync и всегда загружаюсь в течение нескольких минут, а затем Ошибка GraphQL: Тайм-аут выполнения .

Я пробовал несколько способов, ноВ любом случае это приводит к бесконечной загрузке.

соединение:

Amplify.configure({
    Auth: {
        identityPoolId: config.awsmobile.aws_cognito_identity_pool_id,
        region: config.awsmobile.aws_cognito_region,
        userPoolId: config.awsmobile.aws_user_pools_id,
        userPoolWebClientId: config.awsmobile.aws_user_pools_web_client_id
    }
});


export const client = new AWSAppSyncClient({
    url: config.awsmobile.aws_appsync_graphqlEndpoint,
    region: config.awsmobile.aws_appsync_region,
    auth: {
        type: AUTH_TYPE.AWS_IAM,
        credentials: () => Auth.currentCredentials()
    }
});


export default class App extends Component {
    render() {
        return (
            <div>
                <ApolloProvider client={client}>
                    <Home/>
                </ApolloProvider>
            </div>
        );
    }
}

запрос:

export default class Home extends React.Component {
    render() {
        return (
            <Query variables={{bookCode: "GEN"}} query={gql(query)}>
                {({loading, error, data}) => {
                    if (loading) return (
                        <div className="loading">Loading&#8230;</div>
                    );
                    if (error) return <h1>{console.log(error)}Error :(</h1>;

                    console.log(data);

                    return (<h1>Nice</h1>)
                }}
            </Query>
        )
    }
}

ошибка:

GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL error: Execution timed out. GraphQL erroApolloError.js:58)
    at ObservableQuery.currentResult (ObservableQuery.js:125)
    at Query._this.getQueryResult (react-apollo.browser.umd.js:456)
    at finish (react-apollo.browser.umd.js:635)
    at Query.render (react-apollo.browser.umd.js:642)
    at finishClassComponent (react-dom.development.js:15121)
    at updateClassComponent (react-dom.development.js:15076)
    at beginWork (react-dom.development.js:16066)
    at performUnitOfWork (react-dom.development.js:20086)
    at workLoop (react-dom.development.js:20127)
    at renderRoot (react-dom.development.js:20207)
    at performWorkOnRoot (react-dom.development.js:21164)
    at performWork (react-dom.development.js:21074)
    at performSyncWork (react-dom.development.js:21048)
    at requestWork (react-dom.development.js:20903)
    at scheduleWork (react-dom.development.js:20716)
    at Object.enqueueForceUpdate (react-dom.development.js:11605)
    at Query.Component.forceUpdate (react.development.js:355)
    at Query._this.updateCurrentData (react-apollo.browser.umd.js:440)
    at Object.error (react-apollo.browser.umd.js:426)
    at notifySubscription (Observable.js:157)
    at onNotify (Observable.js:196)
    at SubscriptionObserver.error (Observable.js:253)
    at eval (ObservableQuery.js:432)
    at Array.forEach (<anonymous>)
    at Object.error (ObservableQuery.js:431)
    at eval (QueryManager.js:530)
    at eval (QueryManager.js:982)
    at Array.forEach (<anonymous>)
    at eval (QueryManager.js:981)
    at Map.forEach (<anonymous>)
    at QueryManager.broadcastQueries (QueryManager.js:977)
    at Object.next (QueryManager.js:1060)
    at notifySubscription (Observable.js:152)
    at onNotify (Observable.js:196)
    at SubscriptionObserver.next (Observable.js:248)
    at eval (bundle.esm.js:98)
    at Array.forEach (<anonymous>)
    at Object.next (bundle.esm.js:97)
    at notifySubscription (Observable.js:152)
    at onNotify (Observable.js:196)
    at SubscriptionObserver.next (Observable.js:248)
    at notifySubscription (Observable.js:152)
    at onNotify (Observable.js:196)
    at SubscriptionObserver.next (Observable.js:248)
    at notifySubscription (Observable.js:152)
    at onNotify (Observable.js:196)
    at SubscriptionObserver.next (Observable.js:248)
    at notifySubscription (Observable.js:152)
    at onNotify (Observable.js:196)

Я сделал это по-другому, это почти похоже, если это необходимо, я предоставлю код позже

...