withastro / adapters

Home for Astro's core maintained adapters
69 stars 40 forks source link

Cloudflare v10 navigating to a non-existent page (404) with React causes react minified errors with Wrangler #214

Open dallyh opened 7 months ago

dallyh commented 7 months ago

Astro Info

Astro                    v4.5.12
Node                     v20.12.0
System                   Windows (x64)
Package Manager          npm
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/react

Describe the Bug

When using v10 version of the adapter, hybrid output mode and React integration, navigating to a page which causes 404 causes multiple React minified errors when previewing with Wrangler.

Steps to reproduce

[wrangler:inf] Ready on http://127.0.0.1:4321
⎔ Starting local server...
X [ERROR] Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

      at Z
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:217:491)
      at Zc
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:211:485)
      at Z
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:217:89)
      at Uc
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:225:218)
      at null.<anonymous>
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:237:279)
      at new Promise (<anonymous>)
      at reactDomServer_browser_production_min.renderToReadableStream
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:236:83)
      at renderToReadableStreamAsync
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:499:47)
      at Object.renderToStaticMarkup
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:416:17)
      at renderFrameworkComponent
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/chunks/astro_Bticr204.mjs:1614:68)
  Error: Minified React error #31; visit
  https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D for
  the full message or use the non-minified dev environment for full errors and additional helpful
  warnings.
      at Z
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:217:491)
      at Zc
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:211:485)
      at Z
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:217:89)
      at Uc
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:225:218)
      at null.<anonymous>
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:237:279)
      at new Promise (<anonymous>)
      at reactDomServer_browser_production_min.renderToReadableStream
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:236:83)
      at renderToReadableStreamAsync
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:499:47)
      at Object.renderToStaticMarkup
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/renderers.mjs:416:17)
      at renderFrameworkComponent
  (file:///C:/Users/honda/Documents/Repos/astro-cf-10-issues/.wrangler/tmp/pages-FlcOXO/chunks/astro_Bticr204.mjs:1614:68)

[wrangler:inf] GET /test/test 404 Not Found (21ms)  

What's the expected result?

No errors should be thrown.

Link to Minimal Reproducible Example

https://github.com/dallyh/astro-cf-10-issues/tree/minified-react-errors

Participation

alexanderniebuhr commented 7 months ago

I think it might be solved if https://github.com/withastro/adapters/issues/211 is solved.. But I'll need to investigate that further :)

alexanderniebuhr commented 6 months ago

Ok I played with this a little bit.. I have no idea why this happens ... Even fixing all other react related issues, doesn't seem to resolve this 🤔

alexanderniebuhr commented 4 months ago

I don't expect this to be fixed by v11, but might be worth to try again.

dallyh commented 4 months ago

Indeed it did not help, i updated the repo branch.

[wrangler:inf] GET /test/test 404 Not Found (20ms)                                                                                                                                                                                                                           
X [ERROR] Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

...