deprecated icon indicating copy to clipboard operation
deprecated copied to clipboard

with-apollo example is outdated

Open overpod opened this issue 7 years ago β€’ 1 comments

I'm moving back to run an example with-apollo

Error

<ApolloProvider>.provide() is deprecated. Use the 'apolloProvider' option instead with the provider object directly.
TypeError: Cannot read property 'getMatchedComponents' of undefined
    at _callee$ (node_modules/ream/lib/plugins/apollo/apollo-inject.js:7:0)
    at tryCatch (/home/trofimov/Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Ρ‹/projects/ream/examples/with-apollo/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/home/trofimov/Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Ρ‹/projects/ream/examples/with-apollo/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (/home/trofimov/Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Ρ‹/projects/ream/examples/with-apollo/node_modules/regenerator-runtime/runtime.js:114:21)
    at asyncGeneratorStep (server.js:977:103)
    at _next (server.js:979:194)
    at server.js:979:364
    at new Promise (<anonymous>)
    at server.js:979:97
    at server.js:1018:19
    at _callee$ (node_modules/ream/app/utils.js:41:0)
    at tryCatch (/home/trofimov/Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Ρ‹/projects/ream/examples/with-apollo/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/home/trofimov/Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Ρ‹/projects/ream/examples/with-apollo/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (/home/trofimov/Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Ρ‹/projects/ream/examples/with-apollo/node_modules/regenerator-runtime/runtime.js:114:21)
    at asyncGeneratorStep (server.js:836:103)
    at _next (server.js:838:194)

help me please

overpod avatar Oct 12 '18 06:10 overpod

If you had inspected ctx you would immediately discover that the router is now accessible under ctx.rootOptions.router. The middleware API has been changing lately (and I think has not yet stabilized).

I have no idea what Apollo is but apparently its API has also evolved since the example has been originally prepared. See https://akryum.github.io/vue-apollo/guide/ssr.html#on-the-server.

For starters, you would get rid of provide() and replace it with:

ctx.rootOptions.apolloProvider = apolloProvider

It's not immediately clear how the prefetchAll call should be adjusted. If you figure it out please come up with a fixed version and I'll publish it.

IlyaSemenov avatar Oct 12 '18 07:10 IlyaSemenov