# ApolloError: Internal server error

**URL:** <https://community.apollographql.com/t/apolloerror-internal-server-error/6605>\
**Category:** Client SDKs\
**Tags:** client\
**Created:** [August 15, 2023, 10:13pm UTC](https://community.apollographql.com/t/apolloerror-internal-server-error/6605 "2023-08-15T22:13:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![awareham](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@awareham](https://community.apollographql.com/u/awareham)\
**Post date:** [August 15, 2023, 10:13pm UTC](https://community.apollographql.com/t/apolloerror-internal-server-error/6605/1 "2023-08-15T22:13:31Z")

</div>

Hello! I’m upgrading from Vue 2 to 3. We were using Apollo packages that are now depreciated and had to upgrade and I’m struggling with just the most basic of setup. I think my client setup is wrong. Here’s what I got. Using `@apollo/client 3.8.1` and `@vue/apollo-option 4.0 beta.`

In main.js

```auto
import { createApolloProvider } from '@vue/apollo-option'
import { ApolloClient, InMemoryCache } from '@apollo/client/core';

export const AUTH_TOKEN = 'apollo-token'
const httpEndpoint = 'http://localhost:3000/graphql'

// Create the apollo client
const apolloClient = new ApolloClient({
  uri: httpEndpoint,
  cache: cache,
  resolvers: localResolvers, 
  typeDefs: localSchema,
  // ssrMode: false
});

export function createProvider(options = {}) {
  const apolloProvider = createApolloProvider({
    defaultClient: apolloClient,
    errorHandler(error) {
      console.log(error);
    },
  })

  return apolloProvider;
}

```

localResolvers contain this:

```auto
export default {
  Mutation: {
    setConnectedMutation: (root, { value }, { cache }) => {
      const data = {
        connected: value
      }
      cache.writeData({ data })
    },
    // ... more resolver mutations
  }
}

```

and localSchema:

```auto
import gql from 'graphql-tag'

export default gql`
  type Package {
    to: String!
    from: String!
  }
  type Page {
    id: String!
    name: String!
  }
  type Query {
    appName: String
    connected: Boolean!
    delivery: Package!
  }
  type Mutation {
    setConnected(value: Boolean!): Boolean
  }
`

```

I have tried the client with just the cache and link but it doesn’t work. I get this error each time.

```auto
ApolloError: Internal server error
    at new ApolloError (index.js:26:1)
    at eval (QueryManager.js:648:1)
    at both (asyncMap.js:16:1)
    at eval (asyncMap.js:9:1)
    at new Promise (<anonymous>)
    at Object.then (asyncMap.js:9:1)
    at Object.eval [as next] (asyncMap.js:17:1)
    at notifySubscription (module.js:132:1)
    at onNotify (module.js:176:1)
    at SubscriptionObserver.next (module.js:225:1)

```

which is getting fired in the `createProviders`. That’s it on errors. I was hoping it would give me something else but nothing.

---

<div class="post-metadata">

**Author:** ![awareham](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@awareham](https://community.apollographql.com/u/awareham)\
**Post date:** [September 5, 2023, 5:42pm UTC](https://community.apollographql.com/t/apolloerror-internal-server-error/6605/2 "2023-09-05T17:42:44Z")

</div>

So I figured it out after a couple more weeks. I hope this helps someone else. I needed to add an auth middleware to the client with the link.

```auto
const authMiddleware = new ApolloLink((operation, forward) => {
    // add the authorization to the headers
  const token = localStorage.getItem(AUTH_TOKEN);
    operation.setContext({
      headers: {
        authorization: token ? `Bearer ${token}` : "",
      },
    });
    return forward(operation);
});

// Create the apollo client
const apolloClient = new ApolloClient({
  link: concat(authMiddleware, httpLink),
  cache: cache,
  resolvers: localResolvers, 
  typeDefs: localSchema,
  connectToDevTools: true,
  //ssrMode: false,
  onCacheInit: cache => {
    const data = localState
    cache.writeData({ data })
  },
})

```

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:48pm UTC](https://community.apollographql.com/t/apolloerror-internal-server-error/6605/3 "2025-02-06T20:48:20Z")

</div>

Archived on February 6, 2025, 8:48pm UTC


