nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
417 stars 28 forks source link

Prevent DevTools from crashing completely #265

Open MickL opened 1 month ago

MickL commented 1 month ago

🐛 The bug

When working on og images often I run into everything crashing so the DevTools are no more accessible and reloading the page does no better. This means while composing og images (which is not easy due to limitations of Satori) I need to restart the Nuxt dev process over and over again. Sometimes I make changes, restart Nuxt, make change, restart Nuxt, and so on ...

I would be nice if when something crashes not the whole DevTools go down and I could reload the page and everything is fine again or (better) after a file change everything works again.

For example, if I just place three images <img src="/images/1.jpg" /> that are 1500px wide each, everything crashes:

thread '<unnamed>' panicked at /Users/runner/.cargo/git/checkouts/resvg-4b7e4ee32ad6d954/3495d87/crates/resvg/src/geom.rs:27:61:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

 ERROR  [unhandledRejection] socket hang up 
 at Socket.socketOnEnd (node:_http_client:516:23)
 at Socket.emit (node:events:531:35)
 at endReadableNT (node:internal/streams/readable:1696:12)
 at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Image

🛠ī¸ To reproduce

-

🌈 Expected behavior

Catch errors and keep the process alive

ℹī¸ Additional context

No response

MickL commented 1 month ago

I upgrade to 3.x, seems to be more forgiving overall but same behavior, crashes with same errors

harlan-zw commented 1 month ago

This seems to be an issue with the ReSVG wasm crashing the node instance, are you able to provide a reproduction?

It may come down to a Node version or OS issue.

PGimenez commented 4 weeks ago

I'm having the same issue when building a static Nuxt site. It crashes with this error

thread '<unnamed>' panicked at /Users/runner/.cargo/git/checkouts/resvg-4b7e4ee32ad6d954/3495d87/crates/resvg/src/geom.rs:27:61:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:        0x11fcfc584 - _napi_register_module_v1
   1:        0x11fba53e8 - <unknown>
   2:        0x11fcdc15c - _napi_register_module_v1
   3:        0x11fcfde18 - _napi_register_module_v1
   4:        0x11fcfd5f8 - _napi_register_module_v1
   5:        0x11fcfe65c - _napi_register_module_v1
   6:        0x11fcfe0fc - _napi_register_module_v1
   7:        0x11fcfe08c - _napi_register_module_v1
   8:        0x11fcfe080 - _napi_register_module_v1
   9:        0x11fdcf6d0 - _napi_register_module_v1
  10:        0x11fdcf7f8 - _napi_register_module_v1
  11:        0x11fc61d10 - _napi_register_module_v1
  12:        0x11fc64cdc - _napi_register_module_v1
  13:        0x11fc61788 - _napi_register_module_v1
  14:        0x11fc6153c - _napi_register_module_v1
  15:        0x11fc64250 - _napi_register_module_v1
  16:        0x11fc64d1c - _napi_register_module_v1
  17:        0x11fc61a30 - _napi_register_module_v1
  18:        0x11fc64cdc - _napi_register_module_v1
  19:        0x11fc61788 - _napi_register_module_v1
  20:        0x11fc6153c - _napi_register_module_v1
  21:        0x11fb8200c - <unknown>
  22:        0x11fb84cf4 - <unknown>
  23:        0x104af66bc - __ZN6v8impl12_GLOBAL__N_123FunctionCallbackWrapper6InvokeERKN2v820FunctionCallbackInfoINS2_5ValueEEE
fatal runtime error: failed to initiate panic, error 5
[1]    61531 abort      npm run build

I configured nitro rendering like this

nitro: {
    prerender: {
      crawlLinks: true,
      concurrency: 10,
      failOnError: false,
      static: true,
    }
  }

These are my system details

- Operating System: `Darwin`
- Node Version:     `v22.6.0`
- Nuxt Version:     `3.13.2`
- CLI Version:      `3.14.0`
- Nitro Version:    `2.9.7`
- Package Manager:  `yarn@1.22.21`
- Builder:          `-`
- User Config:      `-`
- Runtime Modules:  `-`
- Build Modules:    `-`