Необработанный (в реакции-аполлоне) при попытке запустить graphql - PullRequest
0 голосов
/ 06 апреля 2020

Я работаю на стороне клиента моего приложения, но не могу подключиться к моему бэкэнду. Проблема сохраняется со следующим кодом.

import React, { Component } from 'react';
import styled from 'styled-components/native';
import { graphql } from 'react-apollo'

import FeedCard from '../components/FeedCards/FeedCard';
import GET_POSTS_QUERY from '../graphql/queries/getPosts';

const Root = styled.View`
  flex: 1;
  justifyContent: center;
  backgroundColor: #f2f2f2;
  paddingTop: 5;
`;

const List = styled.ScrollView`
  flex: 1;
`;

class HomeScreen extends Component {
  state = { }
  render() {

    return (
    <Root>
        <List>
          <FeedCard />
        </List>
    </Root>
    );
  }
}

export default graphql(GET_POSTS_QUERY)(HomeScreen);

По какой-то причине, когда я добавляю graphql(GET_POSTS_QUERY) и пытаюсь связать его с моим компонентом HomeScreen, я получаю следующую ошибку. Если я запускаю код так же, как export default graphql(GET_POSTS_QUERY)(HomeScreen);, он работает нормально, но я хочу иметь возможность подключиться к серверной части.

Unhandled (in react-apollo), ApolloError@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:144874:32
currentResult@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:145032:38
dataForChild@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:131454:69
render@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:131511:41
finishClassComponent@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:18218:43
updateClassComponent@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:18181:50
beginWork$$1@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:23660:31
performUnitOfWork@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:22813:30
workLoopSync@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:22795:45
renderRoot@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:22559:29
renderRoot@[native code]
runRootCallback@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:22320:34
runRootCallback@[native code]
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:13050:38
unstable_runWithPriority@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:43130:30
flushSyncCallbackQueueImpl@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:13045:28
flushSyncCallbackQueue@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:13034:35
scheduleUpdateOnFiber@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:22202:37
enqueueForceUpdate@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:14648:23
forceUpdate@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:5106:40
forceRenderChildren@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:131424:50
next@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:131391:40
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:145338:26
forEach@[native code]
error@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:145336:36
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:146249:33
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:146840:25
forEach@[native code]
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:146836:30
forEach@[native code]
broadcastQueries@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:146832:49
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:146197:39
tryCallOne@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:27449:16
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:27550:27
_callTimer@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:31004:17
_callImmediatesPass@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:31040:19
callImmediates@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:31259:33
callImmediates@[native code]
__callImmediates@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:3157:35
http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:2934:34
__guard@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:3140:15
flushedQueue@http://127.0.0.1:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:2933:21
flushedQueue@[native code]
callFunctionReturnFlushedQueue@[native code]
- node_modules\react-native\Libraries\YellowBox\YellowBox.js:63:8 in console.error
- node_modules\expo\build\environment\muteWarnings.fx.js:27:24 in error
- node_modules\react-apollo\react-apollo.browser.umd.js:495:37 in setTimeout$argument_0
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:146:14 in _callTimer
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:399:17 in callTimers
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:436:47 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:111:26 in __guard$argument_0        
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:384:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:110:17 in __guard$argument_0        
* [native code]:null in callFunctionReturnFlushedQueue

Любые идеи, которые могут помочь мне встать на правильный путь, будут оценены , Я думал, что это может быть потому, что у меня уже запущен внутренний сервер, но согласно руководству, которое я прочитал, cross-env NODE_ENV=dev nodemon должен позаботиться об этом.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...