framework icon indicating copy to clipboard operation
framework copied to clipboard

[wip] errors to improve

Open danielroe opened this issue 4 years ago • 9 comments

Lots of errors can be improved - I'll collect them as I encounter them in this issue.

invalid/unknown component error

Server

[Vue warn]: Failed to resolve component: unknown-component
Invalid value used as weak map key

Client

Unclear what the issue is:

GET /

TypeError: Invalid value used as weak map key

at WeakMap.set ()
at normalizePropsOptions (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3602:11)
at createComponentInstance (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6939:23)
at renderComponentVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:159:22)
at Object.ssrRenderComponent (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:487:12)
at _sfc_ssrRender$1 (./playground/.nuxt/dist/server/entry.js:342:24)
at renderComponentSubTree (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:225:13)
at renderComponentVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:176:16)
at renderVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:266:22)
at renderVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:272:17)

invalid module entrypoint

Server

[error] Cannot load nuxt. TypeError: handler.call is not a function
    at ./nuxt/framework/packages/kit/src/module/install.ts:62:48
    at Object.call (./nuxt/framework/node_modules/unctx/dist/index.js:14:19)
    at installModule (./nuxt/framework/packages/kit/src/module/install.ts:62:23)
    at initNuxt (./nuxt/framework/packages/nuxt3/src/nuxt.ts:36:34)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async load (./nuxt/framework/packages/cli/src/commands/dev.ts:53:7)
    at async Object.invoke (./nuxt/framework/packages/cli/src/commands/dev.ts:74:3)
    at async _main (./nuxt/framework/packages/cli/src/index.ts:32:7)

Client

Error while loading nuxt. Please check console and fix errors.

composables outside of context

This only occurs on server, and gives error:

[nuxt] [request error] nuxt instance unavailable

danielroe avatar Jun 16 '21 10:06 danielroe

Related to #156 to control error states

pi0 avatar Jun 16 '21 12:06 pi0

I found this open issue because I'm seeing this during SSR:

✔ Server built in 12795ms                                                                                                                                                  09:00:46
✔ Generated public .output/public                                                                                                                                    nitro 09:00:46
ℹ Initializing prerenderer                                                                                                                                           nitro 09:00:46
ℹ Prerendering 2 initial routes with crawler                                                                                                                         nitro 09:00:54

 ERROR  [nuxt] [request error] Invalid value used as weak map key                                                                                                          09:00:55
  at WeakMap.set (<anonymous>)
  at normalizePropsOptions (./.nuxt/prerender/chunks/index.mjs:4630:11)
  at createComponentInstance (./.nuxt/prerender/chunks/index.mjs:7486:23)
  at renderComponentVNode (./.nuxt/prerender/chunks/index.mjs:9919:22)
  at Object.ssrRenderComponent (./.nuxt/prerender/chunks/index.mjs:10351:12)
  at _sfc_ssrRender (./.nuxt/prerender/chunks/app/server.mjs:10922:32)
  at renderComponentSubTree (./.nuxt/prerender/chunks/index.mjs:9991:13)
  at renderComponentVNode (./.nuxt/prerender/chunks/index.mjs:9936:16)
  at renderVNode (./.nuxt/prerender/chunks/index.mjs:10032:22)
  at renderComponentSubTree (./.nuxt/prerender/chunks/index.mjs:9997:13)

  ├─ / (299ms) (Error: [500] Internal Server Error)   

I'm not seeing the unresolved component warning, though, so I don't really know how to debug it.

edwh avatar Apr 22 '22 09:04 edwh

@edwh I would guess that it's probably a dynamic component using :is.

danielroe avatar Apr 22 '22 09:04 danielroe

@danielroe Thanks for your reply, but it isn't.

I'm very happy to dig into this a bit if there are any simple suggestions as to how to do so. I started adding random console.logs inside node_modules to try to find it, but I'm not making much progress.

edwh avatar Apr 22 '22 09:04 edwh

The error is using a component that isn't registered. Sometimes people only register components in a client-side plugin? Or you might be using a name that doesn't match? For follow-up, would you open a discussion and tag me there? 🙏

danielroe avatar Apr 22 '22 09:04 danielroe

We also get this error when we don't import the component from our ui library, but we are using it somewhere on the page. Since displayed error is quite cryptic and if that specific non-imported component is buried somewhere deep inside the component hierarchy, it can take a while for us to find the source of the problem.

dakt avatar Jun 30 '22 09:06 dakt

Hello @danielroe 👋,

I am facing a similar issue when I try to deploy my Nuxt 3 app (v3.0.0-rc.6) on Netlify, I get this error :

Netlify

I am using the vue router api with a :is dynamic components in order to create js transitions between my pages :

 <router-view v-slot="{ Component }">
       <transition
              mode="out-in"
              :css="false"
              @before-leave="onBeforeLeave"
              @leave="onLeave"
              @enter="onEnter"
              @after-enter="onAfterEnter"
            >
              <component :is="Component" />
       </transition>
</router-view>

I am a bit confused on how to fix the issue 😅

BenjaminOddou avatar Aug 02 '22 16:08 BenjaminOddou

It means you've not registered a component you're using somewhere. I don't think the issue is the code you've included. I'd suggest creating a GH discussion with a minimal reproduction of your issue for people to have a look at.

danielroe avatar Aug 02 '22 16:08 danielroe

https://github.com/nuxt/framework/issues/6161

BenjaminOddou avatar Aug 02 '22 16:08 BenjaminOddou

This issue is now resolved. Modules now give this error:

 ERROR  Cannot start nuxt:  Nuxt module should be a function: [object Object]          14:57:02

  at normalizeModule (node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit-edge/dist/index.mjs:472:11)

... and the weak map issue is resolved in Vue 3.2.38.

danielroe avatar Aug 31 '22 13:08 danielroe