nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
929 stars 195 forks source link

No longer possible to use a relative url #507

Open PssbleTrngle opened 1 year ago

PssbleTrngle commented 1 year ago

Environment

Describe the bug

In previous versions, it was possible to use a relative httpEndpoint url. In development, this could get redirected using the nitro proxy. With the newest release, I now get the error Failed to parse URL from /api/graphql

Expected behaviour

A relative url should also be a viable input for the httpEndpoint property

Reproduction

apollo.config.ts

export default defineApolloClient({
   httpEndpoint: '/api/graphql'
})

next.config.ts

   ...
   nitro: {
      devProxy: {
         '/api': 'http://localhost:8080/api',
      },
   },

Additional context

No response

Logs

500
Failed to parse URL from /api/graphql

at C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\@apollo\client\core\QueryManager.js:679:19
at both (C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\@apollo\client\utilities\observables\asyncMap.js:17:53)
at C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\@apollo\client\utilities\observables\asyncMap.js:10:72
at new Promise ()
at Object.then (C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\@apollo\client\utilities\observables\asyncMap.js:10:24)
at Object.error (C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\@apollo\client\utilities\observables\asyncMap.js:18:49)
at notifySubscription (C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\zen-observable\lib\Observable.js:140:18)
at onNotify (C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\zen-observable\lib\Observable.js:179:3)
at SubscriptionObserver.error (C:\Users\niwi\Desktop\Repos\Personal\Atlas\node_modules\zen-observable\lib\Observable.js:240:7)
bgondy commented 4 months ago

Just faced the same issue but occurs only in server-side for me. Any update on this ?