Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt: All pages show a warning "Cannot stringify a function Object", how do I find out where it is coming from?

Tags:

nuxt.js

I have a fairly large project everything works without any issues except for a warning. The warning shows "Cannot stringify a function Object" without any fnction name. So I am unable to figure out where it is coming from or what is causing it.

I tried commenting out all the middlewares I have, plugins I have and even created a new page with base minimum skeleton code and yet this warning appears when I access it.

What I am looking for is a way to find out the place or code where the warning is coming from?

Sorry, I can't share my code. Its the whole project and I am not able to recreate the warning as well. So is it possible to figure it out?

like image 412
defiant Avatar asked Sep 16 '19 14:09

defiant


2 Answers

That warning comes from @nuxt/devalue library, that is used by Nuxt to serialize state from server to client. E.g. its used to pass state from asyncData, data, vuex store state from server to client, so you need to check it.

like image 177
Aldarund Avatar answered Sep 28 '22 15:09

Aldarund


To clarify, Nuxt serializes state from server to client i.e. it passes state from asyncData, data, vuex store state from server to client. The package that throws this error is @nuxt/devalue used by Nuxt.

To resolve, make sure that state is plain object.

like image 29
Raush Avatar answered Sep 28 '22 15:09

Raush