Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR fails on async components #402

Closed
jakub300 opened this issue Sep 29, 2018 · 4 comments
Closed

SSR fails on async components #402

jakub300 opened this issue Sep 29, 2018 · 4 comments

Comments

@jakub300
Copy link

Steps to reproduce:

  1. Create project using vue cli with vue router, ssr and apollo.
  2. In Home.vue replace HelloWorld component in components with HelloWorld: () => import('@/components/HelloWorld.vue'),
  3. Error similar to the one below will be shown in terminal after ssr attempt (manual page enter/refresh):
(node:2248) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'props' of undefined
    at normalizeProps (E:\Projects\Learning\vue-test-1\node_modules\vue\dist\vue.runtime.common.js:1354:23)
    at Object.mergeOptions (E:\Projects\Learning\vue-test-1\node_modules\vue\dist\vue.runtime.common.js:1456:3)
    at exports.getMergedDefinition (E:\Projects\Learning\vue-test-1\node_modules\vue-apollo\lib\utils.js:14:27)
    at Promise.then.component (E:\Projects\Learning\vue-test-1\node_modules\vue-apollo\ssr\utils.js:188:19)

The origin of the stack trace:

  • /ssr/index.js: vm.$createElement is called with component name and passes it to resolveComponent
  • /ssr/utils.js: resolveComponent calls resolveAsset that returns function (it is our function that returns import)
  • that function is later passed to getMergedDefinition that passes it to Vue's mergeOptions
  • mereOptions reads .options from it, at this point child is undefined because options exists only on real components
  • mergeOptions is calling normalizeProps that attempts to read .props
@dohomi
Copy link
Contributor

dohomi commented Oct 6, 2018

Any idea how to solve this issue? I'd like to publish a working solution for the apollo module on Nuxt. This issue happens after beta.19 release

@Akryum
Copy link
Member

Akryum commented Nov 8, 2018

It will be solved with vuejs/vue#9017

@chanlito
Copy link

Has this been fixed?

@Akryum
Copy link
Member

Akryum commented Jan 9, 2019

See #469

@Akryum Akryum closed this as completed Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants