contentful / contentful.js

JavaScript library for Contentful's Delivery API (node & browser)
https://contentful.github.io/contentful.js
MIT License
1.19k stars 200 forks source link

Nuxt 3 Contentful 'get' on Proxy did not return its actual value Error #1600

Open JackEdwardLyons opened 1 year ago

JackEdwardLyons commented 1 year ago

Hi there, I have this error coming up in a variety of ways when running nuxt build. The error varies based on different Contentful content data, but the error looks like this:

 ERROR  [nuxt] [request error] [unhandled] [500] 'get' on proxy: property 'pageHero' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '#<_ContentfulEntry>' but got '#<_ContentfulEntry>')
  at ./.nuxt/prerender/chunks/renderer.mjs:194:86  
  at Array.map (<anonymous>)  
  at stringify (./.nuxt/prerender/chunks/renderer.mjs:194:39)  
  at ./.nuxt/prerender/chunks/renderer.mjs:194:71  
  at Array.map (<anonymous>)  
  at stringify (./.nuxt/prerender/chunks/renderer.mjs:194:39)  
  at ./.nuxt/prerender/chunks/renderer.mjs:194:71  
  at Array.map (<anonymous>)  
  at stringify (./.nuxt/prerender/chunks/renderer.mjs:194:39)  
  at ./.nuxt/prerender/chunks/renderer.mjs:194:71

Expected Behavior

This error should not exist. I have no idea how to trace this error.

Actual Behavior

When I comment out the areas of my codebase that use pageHero, for example, the error still persists. Thus I assume it's related to something higher up the chain, like the actual content I am querying from Contentful. The stack trace doesn't provide any clues and the error expected '#<_ContentfulEntry>' but got '#<_ContentfulEntry>' is cryptic. I'm not sure how to dive deeper into the stack trace to actually see what the return value of #<_ContentfulEntry> is.

Possible Solution

No idea at this stage? Better stack tracing?

Steps to Reproduce

Very hard to reproduce at this stage without pulling apart the entire codebase and sharing sensitive information. I just wondered if anyone else has faced this issue and / or some helpful pointers to try and debug this issue?

Context

I'm trying to build and deploy my app in Nuxt 3 using nuxt build

Environment

axe312ger commented 1 month ago

Nuxt should now work properly thanks to my changes for v11. Can you please test the new version of this package if your issues are resolved? @JackEdwardLyons