Skip to content

TypeError: (0 , _extractFiles.extractFiles) when using with create-react-app and Typescript #56

Closed
@hxuanhung

Description

@hxuanhung

Hi, I got the folowing error when I try to use apollo-upload-client with create-react-app and Typescript:

TypeError: (0 , _extractFiles.extractFiles) is not a function

My package verions:

        "apollo-cache-inmemory": "^1.1.5",
        "apollo-client": "^2.2.0",
        "apollo-link": "^1.0.7",
        "apollo-link-context": "^1.0.3",
        "apollo-link-error": "^1.0.3",
        "apollo-link-http": "^1.3.2",
        "apollo-upload-client": "^7.0.0-alpha.3",
        "react": "^16.0.0",
        "react-apollo": "^2.0.4",
        "react-dev-utils": "^4.1.0",
        "react-dom": "^16.0.0",
        "typescript": "^2.6.2",

And here is my setup:

import { createUploadLink } from 'apollo-upload-client/lib';
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { onError } from 'apollo-link-error';

const errorLink = onError(({ networkError, graphQLErrors }) => {
  if (graphQLErrors) {
    graphQLErrors.map(({ message, locations, path }) =>
      debug(
        `[GraphQL error]: Message: ${message}, Location:`,
        locations,
        `Path: ${path}`
      )
    );
  }

  if (networkError) {
    debug(`[Network error]: ${networkError}`);
  }
});

const link = createUploadLink({
  uri: '/graphql',
  credentials:
    process.env.NODE_ENV === 'development' ? 'include' : 'same-origin',
  headers: {
    authorization: localStorage.getItem(TOKEN)
      ? `Bearer ${localStorage.getItem(TOKEN)}`
      : null
  }
});

const client = new ApolloClient({
  cache: new InMemoryCache(),
  link: errorLink.concat(link)
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions